Showing posts from November, 2011

Resolving the "Unable to load the specified metadata resource" Error When Using a Devart Entity Model

I recently made use of a Devart Entity Model to allow me to use LINQ with an Oracle database and to get around an issue when using views with Entity Framework 4.1. Everything worked well...until the code was deployed. When running on my local PC (either through Visual Studio or from another site under my local IIS) the code worked without a problem. But when built using our build machine, I would receive the "Unable to load the specified metadata resource" exception when trying to call a service method that made use of the entity model.

When I used IL DASM (ildasm.exe) to examine the manifests of the assembly built locally versus the one built on the build machine, I found that, indeed, the resources for the Devart Entity Model were not present in the assembly manifest of the assembly that was built on the build machine.

The solution -- and it's not a good solution -- was to install the Devart developer tools on the build machine. Again, this is not a good solution -- one …

Resolving a Problem When Adding A Reference to a WCF Service

Awhile ago, I was having issues adding a WCF service reference to a project I was working on. I was getting an error when trying to add the reference that said “Custom tool error: Failed to generate code for the service reference”. Looking at the Reference.cs file for the service, it was blank except for the comment block at the top.

The answer lied in one of the warning messages (I've changed some of the assembly and namespace names below to protect my company's privacy):

Custom tool warning: Cannot import wsdl:portType
Detail: An exception was thrown while running a WSDL import extension: System.ServiceModel.Description.DataContractSerializerMessageContractImporter
Error: List of referenced types contains more than one type with data contract name 'Content' in namespace ''. Need to exclude all but one of the following types. Only matching types can be valid references: