I recently installed the Visual Studio 11 Beta alongside Visual Studio 2010. After that I was unable to build my projects in Visual Studio 2010 that rely on PostSharp so I uninstalled Visual Studio 11 and the .Net Framework 4.5 Beta.
When I now try to build my projects in Visual Studio 2010 I get the following error:
Error 20: The "EntityHydrate" task failed unexpectedly. System.TypeInitializationException: The type initializer for 'Microsoft.Data.Entity.Design.Model.SchemaManager' threw an exception. ---> System.MissingFieldException: Field not found: 'System.Data.Entity.Design.EntityFrameworkVersions.Version3'. at Microsoft.Data.Entity.Design.Model.SchemaManager..cctor() --- End of inner exception stack trace --- at Microsoft.Data.Entity.Design.Model.SchemaManager.GetSchemaVersion(XNamespace xNamespace) at Microsoft.Data.Tools.Integration.Build.EntityHydrate.Execute() at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask, Boolean& taskResult) BuildingModule
I already reinstalled Entity Framework 4.1 and .Net Framework 4 without success. I also was unable to find information about the purpose of the "EntityHydrate" task or why it tries to access the "Version3" namespace of entity framework.
Any idea how to fix this? I couldn't find a download link to Entity Framework 3, maybe that could solve the problem?
Thank you.
Thanks for raising this. We (the EF team) did some investigation and we concluded that the issue could be triggered in a machine that contains SQL Server 11 and Visual Studio 11 Beta.
In the beta, the setup of the EF Tools (also known as "SQL Server Data Framework Tools") contains this MSBUILD targets file:
C:\Program Files (x86)\MSbuild\4.0\Microsoft.Common.Targets\ImportAfter\Microsoft.Data.Tools.Integration.targets
Note: Use “Program Files” without “(x86)” if you have the 32 bits version of Windows.
This file is a stale remnant of the integration between the Entity Framework Designer and SQL Server Data Tools, which was contained in the Visual Studio 11 Developer Preview but removed in the beta (see here for more details). The file has been removed in more recent internal builds, so it won't be present in RTM.
You might be able to work around this problem you can remove or rename the targets file, e.g. adding the .backup extension to it.
EDIT: Scratch that... Someone reports below that renaming is not sufficient. You have to remove the file.
The other workaround suggested in this thread will also work but it has the big disadvantage of removing the whole Entity Framework Designer from your Visual Studio setup.
I finally figured it out. The problem is caused by Entity Framework 5 that is installed with .Net Framework 4.5 Beta. EF 5 is referenced by the Version3 constant that is mentioned in the error message. The internal name of EF 4 is Version2.
The "Microsoft.Data.Entity.Design.Model.SchemaManager" class is part of a component called SQL Server Data Framework Tools which is installed with Visual Studio 11. Even after I had uninstalled all Visual Studio 11 and .Net Framework 4.5 related stuff this component was still there and used by VS 2010 for projects that make use of the Entity Framework.
After I removed that component everything is working again. There might be more than one entry for this in the list of installed programs, just search for "data" to find them.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With