O'Reilly logo

Inside the Microsoft® Build Engine: Using MSBuild and Team Foundation Build by William Bartholomew, Sayed Ibrahim Hashimi

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Environment Variables

We have described the basic usage of properties. Now we’ll discuss a few other related aspects. When you are building your applications, sometimes you might need to extract values from environment variables. This is a lot simpler than you might imagine using MSBuild. You can access values, just as you would properties, for environment variables. For example, take a look at the following project file, Properties04.proj.

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

  <Target Name="PrintEnvVar">
    <Message Text="Temp: $(Temp)" />
    <Message Text="Windir: $(windir)" />
    <Message Text="VS80COMNTOOLS: $(VS80COMNTOOLS)" />
    <Message Text="VS90COMNTOOLS: $(VS90COMNTOOLS)" />
  </Target>

</Project>

In this example, we ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required