在我的解决方案中,我有项目引用(例如)“使用特定版本”设置为false的System.ServiceModel.dll。 一切都与MSBuild 3.5良好。我可以使用msbuild 4.0来定位dotnet 3.5吗?
我想使用msbuild 4.0以便使用property functions。我尝试传递属性“TargetFrameworkVersion = 3.5; ToolsVersion = 3.5”。但是,我收到以下错误:
Could not load file or assembly 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.configuration.dll' or one of its dependencies.
如果我使用msbuild 3.5,则不会发生这种情况。
我可以在不指定项目文件中的版本的情况下进行此项工作吗? (今后我们可能想升级应用程序到dotnet 4)
编辑:我尝试在“外部”调用中使用msbuild 3.5,并为那些需要新功能的目标调用msbuild(使用<msbuild>
任务)4.0。这种要么没有运气 - 内调用提供了以下错误信息:
error MSB4062: Could not load file or assembly 'Microsoft.Build.Tasks.v4.0, Version=4.0.0.0 or one of its dependencies. The system cannot find the file specified. Confirm that the declaration is correct, and that the assembly and all its dependencies are available.
标题问题的答案是“是”。我怀疑第二个问题的答案(针对没有项目更改的程序集引用)可能是“否”。 您是否将特定项目定位到.NET 3.5?我的意思是,不是它的依赖关系,而是项目本身的目标框架。您可以在将来更轻松地修改这些内容。 – CJBrew 2012-02-27 11:50:56
解决方案是VS2008。所有项目都以3.5或2.0为目标。 – Rob 2012-02-27 11:55:18
你确定你确实在调用MSBuild.exe 4.0版本的可执行文件吗?它安装在'%windir%\ Microsoft.NET \ Framework \ v4.0.30319 \'(对于32位)。或者确保您使用VS2010命令提示符(不是VS2008命令提示符)。 – 2012-02-28 09:23:44