使用解决方案任务编译.Net Framework 3.5项目时出现NAnt错误:错误MSB4127,错误MSB4060
在执行使用 CC.Net 编译 .Net 3.5 项目的 NAnt 任务时,我遇到了下面列出的错误:
[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>
但是,在我的情况下,错误仍然存在。
干杯。
I run into the error, listed below, when executing a NAnt task that would compile a .Net 3.5 project- with 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.
I quick research points to tha fact that I would need an assembly reference in my app.config file as:
The references in my project has a "Runtime Version" attribute value of 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>
However the error still persists in my case.
Cheers.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
来自
的 NAnt 文档任务:目前,NAnt 0.91 Release Candidate 1 的工作似乎正在进行中。无论如何,我建议通过 NAnt 的 MSBuild 调用来构建解决方案。您可以使用 NAnt 的< 来完成此操作/code> 任务
或 NAntContrib 的
任务。在此处、此处查找更多信息,以及此处。From NAnt documentation for the
<solution>
task:Currently there seems to be work in progress with NAnt 0.91 Release Candidate 1. Anyway I would advise to build solutions via MSBuild call from NAnt. You can do this by using either NAnt's
<exec>
task or NAntContrib's<msbuild>
task. Find more information here, here, and here.