Recently I need to print some special message in C# code to Teamcity build log when executing, Does anyone know how to do that?
like:
//dosomething
//print messages
hope in Teamcity build log can see these messages.
thanks in advance
To be processed by TeamCity, they need to be written to the standard output stream of the build, that is printed or echoed from a build step. It is recommended to output one message per line (by dividing them with symbols) and flush the stdout buffer after each service message.
A build log is an enhanced console output of a build. It is represented by a structured list of the events which took place during the build. Generally, it includes entries on TeamCity-performed actions and the output of the processes launched during the build.
To set the status and/or change the text of the build status (for example, note the number of failed tests if the test framework is not supported by TeamCity), use the buildStatus message with the following format: Copied! status (optional): use the SUCCESS value to change the build status to Success.
If TeamCity doesn't support your testing framework natively, it is possible to modify your build script to report test runs to the TeamCity server using service messages. This makes it possible to display test results in real-time, make test information available on the Tests tab of the Build Results page.
Use Service Messages, for example writing this string to the stdout ##teamcity[message text='Hello from TeamCity']
will cause Hello from TeamCity
to appear in the build log.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With