How To: Set and Environment Variable in MSBuild

One of the things that I like about tools like MSBuild (and NAnt for that matter) is that there is a community that builds up around them providing useful extensions. One such extension that I stumbled across was an MSBuild task from the Microsoft SDC which supports the setting (and getting) of environment variables.

More than anything, this post is just to serve as a reminder to me that this task exists so that I don’t try and create another one down the track.

One thought on “How To: Set and Environment Variable in MSBuild

  1. Joshua Flanagan

    Of course, in MSBuild, there is no need to have a special task to retrieve environment variable values. Just reference them as you would reference any property in an MSBuild script:

    Assuming the USERNAME environment variable is already set on your system, nothing needs to be defined/set within the MSBuild script.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s