Page 2 of 3

I have the same problem in WinForms/VS2008/Win7

Posted: Thu 08 Oct 2009 10:08
by pari
Hi,
I have the same problem ('Unable to load the specified metadata resource').
2 days ago I migrated from Vista to Win7 and now I can build my projects, but after runing I get error 'Unable to load the specified metadata resource'.

...and I discovered an mystery (the same project):

In Vista:
..\bin\Debug\EMIS2DatabaseM2.dll (size 423 424)
..\bin\Debug\EMIS2DatabaseM2.pdb (size 499 200)

In W7:
..\bin\Debug\EMIS2DatabaseM2.dll (size 170 496)
..\bin\Debug\EMIS2DatabaseM2.pdb (size 495 104)

I think, under W7 in library something missing...

PaRi

Posted: Mon 12 Oct 2009 10:43
by AndreyR
Could you please check that your %Windows%\Microsoft.NET\Framework\v3.5 folder contains both Devart.Data.Entity.Build.Tasks.dll and Devart.Data.Entity.targets?

Also please check that the %Windows%\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets file contains the

Code: Select all

  
line.

Posted: Sat 17 Oct 2009 23:42
by Fortis
Is there a solution to this? I have the exact same problem.
Under Vista I dont get errors under WIn7 the compiled DLL is smaller and I get an MetaDataException...
I checked the frameworkfolder: both files are present, however the Import conditons where missing. I added them manually, but still get the same result....

Posted: Mon 26 Oct 2009 09:56
by AndreyR
I have tried to reproduce the problem using Windows 7 and failed.
Please check if your Microsoft.Common.targets file contains the abovementioned Import line.

Posted: Mon 26 Oct 2009 10:10
by Fortis
With the latest version, I dont get this error anymore! :D

Posted: Tue 03 Nov 2009 08:27
by rstefan
I have similar problem with an ASP.NET MVC project and an assembly containing my model.

In VS2008, everything runs fine, using the integrated webserver.

But after creating a deployement project, generating an msi file, and install it on an test server with IIS 6.0, I get a System.Data.MetadataException when I try the web site.
My entity connection is created like this :

Code: Select all

public static EntityConnection CreateConnection(string server, string user, string password)
        {
string metadata = "metadata=res://*/MyModel.csdl|res://*/MyModel.ssdl|res://*/MyModel.msl;provider=Devart.Data.Oracle;provider connection string=\"Server={0};User Id={1};Password={2};Persist Security Info=True\"";
            string connectionString = String.Format(metadata, server, user, password);
            
            return new EntityConnection(connectionString);
        }
and it is used to create the entity container.

I'm using the last version of entity developer (2.20.43) and of dotConnect for Oracle (5.25.49.0)

The setup package that I built must be deployed to customers in first half of november, and I'm running out of ideas to make it works.

Posted: Tue 03 Nov 2009 10:11
by rstefan
I answer to myself.
I found the problem.

In fact, my model files were in a subdirectory of the assembly project.
I notice that, in app.config, the connection string contains the metadata resource string. I used it to build my connection string and it works fine.

The model files must be prefixed with the subdirectory name as :

Code: Select all

res://*/Models.MyModel.csdl|res://*/Models.MyModel.ssdl|res://*/Models.MyModel.msl
If this can help someone else who makes the same mistake than me.

Posted: Wed 25 Nov 2009 14:05
by Fortis
*Edit: I copied the file from a backup and modified the Microsoft.Common.targets manually and now it works again. You might want to check your setup routine.


I just installed the 2.50.50 release under Vista 64 bit and this error came back. I checked the files and "Devart.Data.Entity.Build.Tasks.dll" is there, but "Devart.Data.Entity.targets" is missing (in both Framwork\3.5\ and Framework64\3.5\). Aso, there is no entry in the Microsoft.Common.targets file.

Any advice? I am currently under a deadline, so a fast response would be highly appreciated.
kind regards

AndreyR wrote:Could you please check that your %Windows%\Microsoft.NET\Framework\v3.5 folder contains both Devart.Data.Entity.Build.Tasks.dll and Devart.Data.Entity.targets?

Also please check that the %Windows%\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets file contains the

Code: Select all

  
line.

Posted: Thu 26 Nov 2009 09:43
by AndreyR
Could you please check %Program Files\MSBuild\3.5\Custom.After.Microsoft.Common.targets% for DevartEntityDeploy?
If this file existed before dotConnect is installed, then the problem could occur. We are working on it.

Posted: Thu 26 Nov 2009 11:12
by Fortis
AndreyR wrote:Could you please check %Program Files\MSBuild\3.5\Custom.After.Microsoft.Common.targets% for DevartEntityDeploy?
If this file existed before dotConnect is installed, then the problem could occur. We are working on it.
The file exists and it was put there by Postsharp 1.5.

Code: Select all

  

Posted: Thu 26 Nov 2009 11:36
by AndreyR
The solution with Microsoft.Common.targets editing is valid.
As an alternative you could append text from %Program Files%\MSBuild\Devart\v3.5\D:\Program Files\MSBuild\Devart\v3.5\devart.data.entity.targets file to the %Program Files%\MSBuild\3.5\Custom.After.Microsoft.Common.targets file.

Posted: Tue 01 Dec 2009 09:49
by AndreyR
We have fixed the problem with the installation.
The fix will be included in the nearest build.

Posted: Wed 27 Jan 2010 13:24
by fni
I'm running Vista 7 x64 and Visual Studio 2010 Beta 2 and both the build steps and the Devart build DLLs are missing from the 32-bit or 64-bit "v4.0" framework folder.

So I'm also getting a "Unable to load the specified metadata resource." and if I ask the metadata file to be put in the output folder, nothing is generated.


Edit:
If have updated my %Program Files (x86)%\MSBuild\v4.0\Custom.After.Microsoft.Common.targets file to contain what's in %Program Files (x86)%\MSBuild\Devart\v4.0\Devart.Data.Entity.targets and still I'm not generating metadata ressource files.

Posted: Fri 29 Jan 2010 08:29
by AndreyR
Thank you for the report, we have already found and fixed this problem.
The fix will be available in the nearest build.

Re: Unable to load metadata resource error

Posted: Thu 11 Feb 2010 19:03
by ed_frederick
Using the following configuration:

Windows 7 x64 Enterprise Edition
Visual Studio 2010 RC (Not beta 2...)
dotConnect beta (5.55.90 I think is the correct version number - latest build)

Attempting to create a new console application, add a new Devart Model to the project, drop on one table from the database on to the model.

Any EF query generates the following error:

"Unable to load the specified metadata resource."

Have tried:

All of the above with respect to adding the Devart.Data.Entity.targets files to both v3.5 and v4.0 framework directories.

Ensured that the Custom.After......targets file that exists was created in the MSBuild\Devart\v4.0 custom build task directory and included the expected import node.

Attempted to add the import statement to the Microsoft.Common.targets file in the v3.5 and v4.0 directory with only success in the v3.5 directory as I could never get permission to the v4.0 file to make the appropriate changes (Trusted Installer is the only user with permissions to modify this file).

Have attempted to open the model for editing and change the model level property to include in output directory instead of embed as resource, then clean, rebuild and set the property back to embed as resource with no luck. Also, when setting this property to include in output directory, none of the .*sdl files are generated or written to any output directory.

I have also examined the sizes of the .dll output as the original poster in this thread indicated and did notice a significant difference under VS2010 where the dll is smaller (by approximately the size of the respective resources that should be embedded in the dll and do not appear to be).

You have noted that there was a fix for this with a previous release and it appears that it may have resurfaced after a couple of releases, so I am curious what my next steps need to be. Can you describe the details of the fix or do you have any recommendations for running successfully under v4.0 VS2010 RC?