Override target framework from command line

Viewed 24798

I want to build a c# project(.csproj) from commandline using msbuild and want to target .Net2.0 runtime.

I see that the project xml file has 2 tags of interest

<Project ToolsVersion="4.0" ... 

and

<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>

I was wondering if

  • Can ToolsVersion 4.0 produce compatible code for .Net2.0 runtime?
  • Can I override the target framework tag from the project file via the command line (does the /ToolsVersion command line switch achieve this?

I specifically want to achieve this via command line and not modify the project file.

Currently I am doing something like this

msbuild myproj.csproj /p:Configuration=Release
1 Answers
Related