MSBuild Logger for TeamCity

I'm looking to see if there is already an MSBuild logger that can transform MSBuild output in to the appropriate ##teamcity[message] console output. (https://confluence.jetbrains.com/display/TCD10/Build+Script+Interaction+with+TeamCity)

Does anyone know?

1. Does this exist?

2. Any chance this logger has been compiled to work with .NET Core CLI?

Goal: I'd love to be able to do "dotnet msbuild MyApp.csproj /logger:TeamCityLogger" on Windows/macOs/Linux agents.

FWIW, I've seen a few comments and references to an MSBuild logger named JetBrains.BuildServer.MSBuildLoggers.MSBuildLogger. However, I couldn't find an explanation of where this logger is and how to use it.

0
5 comments

Hi Nate,

we have several build runners (MSBuild, VS Solutions, tests, etc) that already pass the required information to TeamCity via the internal communications channels (those available for plugins without even needing to go through service messages). Service messages are thought better for stuff that can't be passed in via the plugin/runner you are using. If you are looking for something specific to pass, you could mention it and we might make suggestions on what to do based on what exactly it is.

There is a dotnet core CLI plugin here: https://github.com/JetBrains/teamcity-dotnet-plugin, but, as mentioned above, I don't know whether it will have all the functionality you would want from it. You'd need to be more specific.

Regarding the MSBuildLogger, it's an internal logger we have now for MSBuild builds, and you shouldn't bother with it unless we would suggest using it.

Hope this helps.

0
Avatar
Permanently deleted user

> FWIW, I've seen a few comments and references to an MSBuild logger named JetBrains.BuildServer.MSBuildLoggers.MSBuildLogger. However, I couldn't find an explanation of where this logger is and how to use it.

You can pass that logger into _windows_ agents with something like:

msbuild <sln> /t:Build /logger:JetBrains.BuildServer.MSBuildLoggers,%system.teamcity.dotnet.msbuild.extensions4.0%

(or 2.0 for older stuff)

I'm not sure about mac and unix as we don't use those agents, but if you poke around the agent variables you can probably figure it out.

 

 

0
Avatar
Permanently deleted user

@Denis - the plugin is great, but our team prefers to keep TC as similar to our `build.sh` script as possible. Ideally, I'd love to run something like this:

 

#!/usr/bin/env bash

if [[ "${TEAMCITY_PROJECT_NAME}" != '']; then

    logger_args="/logger:JetBrains.BuildServer.MSBuildLogger,$TEAMCITY_LOGGER_FILE"

fi

dotnet msbuild $logger_args MyProj.sln

 

@Skyguy94 thanks for the suggestion. Unfortunately, this only works with MSBuild.exe. When invoking `dotnet msbuild`, this fails with:

 

MSBUILD : error MSB1021: Cannot create an instance of the logger. Could not load file or assembly 'Microsoft.Build.Utilities.v4.0, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified

Switch: JetBrains.BuildServer.MSBuildLoggers,C:\BuildAgent\plugins\dotnetPlugin\bin\JetBrains.BuildServer.MSBuildLoggers.4.0.dll

0
Avatar
Permanently deleted user
0

Hi Nate,

unfortunately we don't have a MSBuild logger for dotnet core just yet. We are working on it, though, although can't currently confirmed when it'll be finished.

0

Please sign in to leave a comment.