My team is migrating from NAnt to MSBuild, though MSBuild is full of a lot of features, but still a lot to be done on MSBuild. People like Neil Enns (Neil.Enns@microsoft.com) (Lead Program Manager, MSBuild) are available to discuss MSBuild related Issues. Here are some tips to use MSBuild related property paths in the msbuild scripts..

  • $(MSBuildExtensionsPath)     ..\Program Files\MSBuild
  • $(MSBuildProjectDirectory)      Where your MSbuild script resides
  • $(MSBuildBinPath)  ..\WINDOWS\Microsoft.NET\Framework\<2.0 framework ver eg. v2.0.50727>

Above 3 paths are very often used in MSBuild scripts, here are few tips How to use these Paths..

  • Put the MSBuild project script file inside $(MSBuildExtensionsPath)\Scripts\Project\project.msbuild
    Idea is to create a seperate folder for a individual project for project msbuild script, so that we ca easily refer the project file path from $(MSBuildProjectDirectory) property inside the msbuild script.
  • Use (MSBuildBinPath) for accessing MSBuild.exe
  • Use $(MSBuildExtensionsPath) for common script files acroos the MSBuild projects scripts.

Reference: http://msdn2.microsoft.com/en-us/library/ms164309.aspx

see also: How to use and manage Versioning for different projects using AssemblyInfoTask (really worthy)
http://spaces.msn.com/emanish/blog/cns!4B02CA80B81E5D0A!192.entry

I'll post more on MSBuild in my future posts... Happy Scripting :)