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
/ToolsVersioncommand 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
You need the commandline arguments for msbuild to make that work:
therfore overriding the value in the proj file aswell as the ToolsVersion.
To find out which msbuild version default is used, start a Visual Studio Command prompt ( found in the Start menu > Microsoft Visual studio 2010 > Visual Studio Tools) and type msbuild.
The first line of the output will hold your BuidEngineversion:
From the msdn doc:
You could also check the Environment vars for a version of the framework installed:
set Ffrom the Visual Studio Command prompt gives me this result:ToolSet Explanation
ToolSetVersion