My pre-generated views for EF4 code First, using this T4 template does not work on the build server. I do not regenerate the view on the build server, I just compile and run MSTest. Error starting tests:
System.Data.MappingException: The mapping and metadata information for the EntityContainer 'DB' no longer matches the information used to create the pre-generated views
I ran the same template on another computer, and the hash values โโare different. I suppose this is the reason why it does not work on the build server. The hash values โโdiffer at run time on other machines, so the check fails and throws an exception.
Using Im:
- VS 2010 Pro
- .Net Framework v4.0.30319
- Entity Framework v4.2 (code first)
- EF CodeFirst View Generation T4 Template for C # (v1.0.1) - slightly modified GetEdmxSchemaVersion to return the correct version of EntityFrameworkVersions for my installation.
- using the class library project template
Those tests that I run connect to the SQL DB file, which is checked by code.
I checked the build server and its version using the same version of the EF dll and .Net Framework.
Any idea why the hash values โโare different?
UPDATE: I created and compared two XML files from two dev machines using EdmxWriter.WriteEdmx ().
Here is the version of the circuit (the same on both machines):
<?xml version="1.0" encoding="utf-8"?> <Edmx Version="2.0" xmlns="http://schemas.microsoft.com/ado/2008/10/edmx">
The obvious difference is the order of some nodes in the XML files. Here is an example:
Machine 1:
<EntityType Name="PersonEntity" BaseType="Self.Entity" /> <EntityType Name="CompanyEntity" BaseType="Self.Entity" />
Machine 2:
<EntityType Name="CompanyEntity" BaseType="Self.Entity" /> <EntityType Name="PersonEntity" BaseType="Self.Entity" />
Any idea why they are in a different order?
UPDATE 2: Edmx (xml) from the build server is also different for the other 2 dev machines. Again, the order of some nodes is different.
Machine 1 and the assembly server have System.Data.Entity.dll (the same version of the file and product is v4.0.30319.1) in% windir% \ Microsoft.NET \ assembly \ GAC_MSIL \ System.Data.Entity \ v4.0_4 .0.0.0__b77a5c561934e089.
UPDATE 3: I also looked at the version of System.Data.Entity.Design.dll. The T4 template refers to this assembly. Machine 1 has two copies of this DLL ... in GAC (v4.0.30319.233) and in C: \ Program Files (x86) \ Reference Assemblies \ Microsoft \ Framework.NETFramework \ v4.0 (v4.0.30319.1), This is also true on the build server and on machine 2. I am wondering if the hash validation function uses this DLL at runtime because it is not mentioned in my project. If so, which version is used. But then again, the hash check succeeded in Machine 1.