开发者

MSBuild 4.0 introduces dependency on 4.0 framework

开发者 https://www.devze.com 2023-03-10 20:58 出处:网络
We\'ve recently upgraded all our .NET projects from VS2005 to VS2010. As a part of this move, we\'ve upgraded from compiling with MSBuild 3.5 to MSBuild 4.0. All our compiles are from the command-line

We've recently upgraded all our .NET projects from VS2005 to VS2010. As a part of this move, we've upgraded from compiling with MSBuild 3.5 to MSBuild 4.0. All our compiles are from the command-line, with the following command (or similar):

msbuild.exe /Target:Publish <solution> /ToolsVersion:2.0

This seemed to work without a problem. However, we've just noticed that we now have a dependency on .NET 4.0 within our ClickOnce application manifest. Under 3.5, we would have the following:

<dependency>
  <dependentAssembly dependencyType="preRequisite" allowDelayedBinding开发者_如何学JAVA="true">
    <assemblyIdentity name="Microsoft.Windows.CommonLanguageRuntime" version="2.0.50727.0" />
  </dependentAssembly>
</dependency>

Under 4.0, this version number has increased to 4.0.30319.0. If we publish from within VS2010 itself, everything appears to work correctly (version number is 2.0 as before).

As a last resort, we can modify the .manifest, resign, update/resign the deployment manifest, but that sounds like alot of steps. Is there a setting somewhere to control this? Has anyone encountered the above problem before?

Cheers, Daniel B.


Leave the ToolsVersion at 4.0 (it just affect the MSBuild version used, and you want the latest), what you need to change is TargetFrameworkVersion: set it to 3.5 or 2.0 (both use the same version with CLR, 3.5 brings additional assemblies). Thus, call msbuild as follows:

msbuild.exe /Target:Publish <solution> /p:TargetFrameworkVersion=3.5
0

精彩评论

暂无评论...
验证码 换一张
取 消