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.