Use properties set in build scripts from within TeamCity

Hello, I'm wondering if there's a way to use from within TeamCity properties that are set in build scripts. For example, I have a MSBuild script which sets some properties for locations where it puts binaries, and I'd like to use them from within TeamCity, for example to configure artifact paths. Is there a way to expose such properties from the build script so that TeamCity can use them?


Comment actions Permalink

If your MSBuild script can write to the console, you could use service messages to set a parameter value.

For example, write the following string to the console:

##teamcity[setParameter name='ddd' value='fff']

TeamCity will create a parameter named 'ddd' which can be used in subsequent build steps.

Also, it looks like TeamCity has MSBuild Service Tasks (; however, setParameter doesn't seem to be supported.


Comment actions Permalink

Hi Bryan,

thanks for your reply. I was aware of service messages, I was more looking for something which would work without changing the script, but I'm not even sure if such a thing would be possible at all. I'm not an MSBuild expert, but I though that if there was some "logger" that you could extend MSBuild with and could be invoked when properties are set within the build script then TeamCity would be able to intercept those properties values while the script is running.

Thanks for the options you mention though, they seem to be the only alternatives right now.



Please sign in to leave a comment.