2

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="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.

Daniel Becroft
  • 716
  • 3
  • 19

1 Answers1

2

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
skolima
  • 31,963
  • 27
  • 115
  • 151
  • Thanks, that did the trick. We were using `ToolsVersion` to work around a pathing issue with the boot-strapper, but once we disabled that entirely, everything worked. Interestingly, we were already specifying the framework version via `` in the project file, but this obviously wasn't being honored. Very strange. – Daniel Becroft Jun 07 '11 at 00:25