Failing to embed EF model when doing TFS build

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
hyiothesia
Posts: 22
Joined: Thu 23 May 2013 20:37

Failing to embed EF model when doing TFS build

Post by hyiothesia » Thu 05 May 2016 23:55

We are getting the following error: Unable to load the specified metadata resource

Last time I had this with the same project the problem was that our TFS build server running TFS 2012 client did not have VS 2012 installed. Once I installed VS 2012 and reinstalled Devart everything worked.

Now we have updated the SAME build server to VS 2015 and TFS 2015. To do this I:
1. Uninstalled TFS 2012 client
2. Uninstalled Devart 8.5.497
3. Uninstalled VS 2013 and VS 2012
4. Installed VS 2015
5. Installed TFS 2015 and configured build controller and agent
6. Installed Devart 8.5.497

I have reinstalled Devart several times with no changes. If I build directly in VS 2015 on the build server (i.e., not a TFS triggered build) then the application does not get the error and the dll that contains the edml is quite a bit larger.

I'm not really sure where to look. Since it seemed like last time the issue was having Devart properly installed with the Visual Studio version that matched the TFS build agent version I thought I would ask here.

Any ideas?

Thank you.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: Failing to embed EF model when doing TFS build

Post by Shalex » Fri 06 May 2016 08:56

That is the error of Entity Framework runtime, which tries to find and load metadata that is mentioned in connection string. The dotConnect for Oracle code is not used yet.

Please try copying metadata to output directory instead of embedding it in your assembly: select your model in Model Explorer > navigate to the Properties window > set Metadata Artifact Processing to CopyToOutputDirectory. Save the project and rebuild it. Does this help?

hyiothesia
Posts: 22
Joined: Thu 23 May 2013 20:37

Re: Failing to embed EF model when doing TFS build

Post by hyiothesia » Fri 06 May 2016 19:11

That did not help. It did not generate the files. In my case, none of the following were present.
SdeDb.SdeDb.csdl
SdeDb.SdeDb.ssdl
SdeDb.SdeDb.msl

And, as expected, I get this error at runtime: System.Data.Entity.Core.MetadataException: The specified metadata path is not valid. A valid path must be either an existing directory, an existing file with extension '.csdl', '.ssdl', or '.msl', or a URI that identifies an embedded resource.

If on the same box I build in VS 2015 it generates the files.

I compared the TFS build logs between a working (another TFS 2012 build server) and this 2015 TFS buid server I see that the following is missing from the server that doesn't work.

DevartEntityDeploy:
DevartEntityDeploy succeeded for 1 items.

This makes me think that whatever TFS is using for the build does NOT have devart properly installed. Is there somewhere I can check in the registry or file system to ensure that Devart is properly configured?

hyiothesia
Posts: 22
Joined: Thu 23 May 2013 20:37

Re: Failing to embed EF model when doing TFS build

Post by hyiothesia » Sat 07 May 2016 00:00

I figured out a way to fix it. On my build server there are a few folders, each with a file named Custom.After.Microsoft.Common.targets
Folders:
"C:\Program Files (x86)\MSBuild\v14.0"
"C:\Program Files (x86)\MSBuild\v12.0"
"C:\Program Files (x86)\MSBuild\v4.0"
"C:\Program Files (x86)\MSBuild\v3.5"

The v14.0 version had

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\Devart\v3.5\Devart.Data.Entity.targets" Condition="'$(ImportDevartEntityDeploy)'!='false' and Exists('$(MSBuildExtensionsPath)\Devart\v3.5\Devart.Data.Entity.targets')" />
</Project>

Where as the other versions only had:
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
</Project>

I added the v14.0 entry into the v12.0 file and it was still broken.
Then I add the the v14.0 entry into the V4.0 file and now my TFS build works and I am still able to embed the model in the dll.

Someday perhaps I will figure out how to get the TFS build agent to use the current MSBuild instead of an old one, but at least it is working.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: Failing to embed EF model when doing TFS build

Post by Shalex » Tue 10 May 2016 12:49

Thank you for your detailed description of the issue you have encountered. We will investigate the question and notify you about the result.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: Failing to embed EF model when doing TFS build

Post by Shalex » Fri 30 Dec 2016 12:27

hyiothesia wrote:Then I add the the v14.0 entry into the V4.0 file and now my TFS build works and I am still able to embed the model in the dll.
Please open the *.csproj file (of the project which failed to embed model resources without v4.0 entry) with XML Editor and specify its ToolsVersion. Most likely, it was not upgraded to "14.0".

Post Reply