Geeks With Blogs
.NET Paradigm Shift Think of Something Different

When you're customizing MSBuild in building a visual studio project, it often becomes important to determine if the build is running on the build server or your development environment.

This information can change the way you set up path variables and other Conditional tasks.I've found many different answers online.

It seems like they all only worked under certain conditions, so none of them were guaranteed to be consistent.So here's the simplest way I've found that has not failed me yet.

    <!-- Determine if the current build is running on the build server -->
    <IsBuildServer Condition="'$(BuildUri)' != ''">true</IsBuildServer>

Shahzad Qureshi is a Software Engineer and Consultant in Salt Lake City, Utah, USA

His certifications include:

Microsoft Certified System Engineer
3CX Certified Partner
Global Information Assurance Certification – Secure Software Programmer – .NET

He is the owner of Utah VoIP Store at and SWS Development at and publishes windows apps under the name Blue Voice.

Posted on Monday, August 27, 2012 2:10 PM .NET , MSBuild | Back to top

Comments on this post: Determining if you’re running on the build server with MSBuild – Easy way

No comments posted yet.
Your comment:
 (will show your gravatar)

Copyright © ParadigmShift | Powered by: | Join free