6 Replies Last post: Feb 9, 2010 7:38 PM by Suraj Gupta  
Suraj Gupta Newbie 16 posts since
Apr 17, 2009
Currently Being Moderated

Feb 9, 2010 6:04 AM

Difference between MSBuild version and MSBuild ToolsVersion?

Folks,

 

Could someone help me understand the difference between the MSBuild version and the MSBuild ToolsVersion?  For example, which decides what version of the C#/VB compiler is used?  How are they different?  When would I set them to different versions of the framework?

 

Thanks!

Eugene Petrenko JetBrains 2,282 posts since
Oct 4, 2004
Currently Being Moderated
Feb 9, 2010 3:33 PM in response to: Suraj Gupta
Re: Difference between MSBuild version and MSBuild ToolsVersion?

MSBuild version is the version of .NET where msbuild was taken.

ToolsVersion is the version of tools (i.e. c# version) that used to compile.

 

Actually, MSBuild supports compilation to older versions, so one may use MSBuild 4.0 with ToolsVersion 2.0 to produce .NET 2.0 assemblies.

 

Please have a look to msdn for more details and further reading

Eugene Petrenko JetBrains 2,282 posts since
Oct 4, 2004
Currently Being Moderated
Feb 9, 2010 6:58 PM in response to: Suraj Gupta
Re: Difference between MSBuild version and MSBuild ToolsVersion?

I think there is a right place to find aswer to your question:

http://msdn.microsoft.com/en-us/library/bb397456(VS.100).aspx

Do not forget to select .NET 3.5 or 4.0 to read actual data.

 

MSBuild Version == .NET Framework version.

Each .NET Framework contains MSBuild.exe inside. I used 'taken' for this.

 

There could be some differences between running a build from MSBuild v2.0 and from MSBuild v4.0 targeted to 2.0.

We simply let used decide what version is required to build their project.

 

On the other hand, there is no easy way for TeamCity build runner to guess msbuild version to tools version for a particular

build. I believe, users should know the version of MSBuild thet is required to build their project.

 

If you do not know the tools version for your build, you may select 'none' to let MSBuild decide.

Setting tools version from TeamCity web UI will be equivalent to setting /toolsversion: commandline argument.

Eugene Petrenko JetBrains 2,282 posts since
Oct 4, 2004
Currently Being Moderated
Feb 9, 2010 7:23 PM in response to: Suraj Gupta
Re: Difference between MSBuild version and MSBuild ToolsVersion?

MSBuild version is used only to find a path to MSBuild.exe process.

 

TeamCity generates an msbuild stript to wrap user's msbuild script. Actually toolsversion will be set to <Project> element of the generated MSBuild script.

It generates <Import> task if user specifies msbuild project and <MSBuild> task if user specifies .sln file (e.g. sln2008 build runner)

More Like This

  • Retrieving data ...