EntityHydrate任务失败任务、EntityHydrate

2023-09-04 22:48:18 作者:观望生世花落黄泉°

我最近安装在Visual Studio 11 Beta版旁边的Visual Studio 2010。在那之后我无法建立我的项目在Visual Studio 2010中依靠PostSharp所以我卸载的Visual Studio 11和.NET Framework 4.5 Beta版。

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.

当我现在尝试建立我的项目在Visual Studio 2010中,我得到了以下错误:

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

我已经重新安装了实体框架4.1和.NET Framework 4没有成功。我也无法找到关于EntityHydrate任务的目的或原因尝试访问实体框架的版本3命名空间的信息。

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.

不知道如何解决这一问题?我无法找到一个下载链接到实体框架3,也许这能解决问题吗?

Any idea how to fix this? I couldn't find a download link to Entity Framework 3, maybe that could solve the problem?

感谢你。

推荐答案

谢谢你提出这个。我们(EF团队)做了一些调查,我们得出结论,这个问题可以在一台机器,它包含的SQL Server 11和Visual Studio 11 Beta版被触发。

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.

在公测中,EF工具(也称为SQL Server数据工具框架)的设置包含该MSBUILD目标文件:

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

注:使用程序文件不(86)如果你有32位版本的Windows。

Note: Use "Program Files" without "(x86)" if you have the 32 bits version of Windows.

这文件是Entity Framework设计和SQL Server数据工具之间的整合,这是包含在Visual Studio 11开发preVIEW但除去在公测的陈旧残余(见这里了解详细信息)。该文件已在最近的内部构建被删除,所以它不会是present在RTM。

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.

您可能能够解决此问题,您可以删除或重命名目标文件,例如:添加扩展的.backup它。

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.

编辑:从头开始的......有人报告低于改名是不够的。你要删除的文件。

在这个线程建议的其他解决方法也可以工作,但它已经从您的Visual Studio安装去除整个Entity Framework设计的最大缺点。

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.