当执行一个可以编译.Net 3.5项目的NAnt任务时,我遇到了下面列出的错误:CC.Net:
[solution] C:\WINDOWS\Microsoft.NET\Framework\v3.5\Microsoft.Data.Entity.targets(40,5): Error MSB4127: The "EntityDeploy" task could not be instantiated from the assembly "C:\WINDOWS\Microsoft.NET\Framework\v3.5\Microsoft.Data.Entity.Build.Tasks.dll". Please verify the task assembly has been built using the same version of the Microsoft.Build.Framework assembly as the one installed on your computer and that your host application is not missing a binding redirect for Microsoft.Build.Framework. Unable to cast object of type 'Microsoft.Data.Entity.Build.Tasks.EntityDeploy' to type 'Microsoft.Build.Framework.ITask'.
[solution] C:\WINDOWS\Microsoft.NET\Framework\v3.5\Microsoft.Data.Entity.targets(40,5): Error MSB4060: The "EntityDeploy" task has been declared or used incorrectly, or failed during construction. Check the spelling of the task name and the assembly name.
[solution] Project 'CAPS.UnitTests.NETVersion3' failed!
[solution] Continuing build with non-dependent projects.
我快速研究一点,事实上我需要在app.config文件中使用汇编引用: 我的项目中的引用具有“运行时版本”属性值v2.0.50727
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.Build.Framework" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-99.9.9.9" newVersion="3.5.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
然而,错误仍然存在于我的案例中。
干杯。
答案 0 :(得分:1)
来自NAnt documentation for the <solution>
task:
目前,只有Microsoft Visual Studio .NET 2002和2003解决方案 和项目得到支持。支持.NET Compact Framework 项目目前也不可用。
目前,NAnt 0.91 Release Candidate 1似乎正在进行中。无论如何,我建议通过来自NAnt的MSBuild来建立解决方案。您可以使用NAnt的<exec>
task或NAntContrib的<msbuild>
task来执行此操作。查找更多信息here,here和here。