C# 使用解决方案任务编译.Net framework 3.5项目时出现NAnt错误:错误MSB4127,错误MSB4060

C# 使用解决方案任务编译.Net framework 3.5项目时出现NAnt错误:错误MSB4127,错误MSB4060,c#,msbuild,nant,C#,Msbuild,Nant,我在执行NAnt任务时遇到下面列出的错误,该任务将使用CC.Net编译.Net 3.5项目: [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\Framew

我在执行NAnt任务时遇到下面列出的错误,该任务将使用CC.Net编译.Net 3.5项目:

[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>

然而,在我的案例中,错误仍然存在

干杯。

来自:

目前,只有Microsoft Visual Studio.NET 2002和2003解决方案 项目得到支持。对.NET Compact Framework的支持 项目目前也不可用


目前,NAnt 0.91发行版候选1的工作似乎正在进行中。无论如何,我建议通过NAnt的MSBuild调用构建解决方案。您可以使用NAnt或NAntContrib来实现这一点。查找更多信息。

干杯,伙计,我已恢复使用您建议的替代方法,MSBuild任务工作正常。谢谢