Matt
Matt

Reputation: 26971

Set up a build step executed only when the project is built from Visual Studio but not on the build server

How can I set a build step that is executed only when built from Visual Studio and not on the build server?

I want a build step for local debugging, but I do not want this step to run when my build runs on TeamCity.

Is there a way to do this?

Upvotes: 3

Views: 71

Answers (1)

Michael Baker
Michael Baker

Reputation: 3434

You can execute your logic conditionally on the presence of an environment variable

Since your question is tagged MSBuild you can do this

<Project DefaultTargets="Build">    
    <Target Name="Build" Condition="'$(TEAMCITY_VERSION)' == ''">  
        <Message Text="Building..."/>  
    </Target>  
</Project>  

Upvotes: 1

Related Questions