Loofer
Loofer

Reputation: 6963

How can MSBuild detect which server it is running on?

I would like my MSbuild build script to be able to detect which server it is running on, if it is a local developers machine then run the targets that install the results on the local machine, if it is running on the build server then run the target that installs on the remote staging server.

What is the best strategy to achieve this?

We use TeamCity as our CI server.

Upvotes: 1

Views: 322

Answers (2)

Alex
Alex

Reputation: 13229

What we do is have a server property we pass on the command line, dev for installing on the local machine, or the name of the server(s) to publish to if on the build server. This was the only way we could figure out.

Upvotes: 2

Paulo Santos
Paulo Santos

Reputation: 11567

have you checked the ServiceController at MSBuild Community Tasks?

Upvotes: 1

Related Questions