JetBrains / teamcity-msbuild-logger

MSBuild logger for TeamCity
Apache License 2.0
19 stars 9 forks source link

Pass-thru custom TeamCity service messages #3

Closed natemcmaster closed 6 years ago

natemcmaster commented 6 years ago

I recently switched to using the TC MSBuild logger. I'd like to keep using it, but discovered that the logger doesn't pass through custom service messages. How can I ensure these messages continue to pass thru the MSBuild logger?

For example, my build uses a service message to ensure XML report processing picks up VS test log files. After switching to TeamCity.MSBuild.Logger, these service messages are not getting passed through to the server. (using TC 10.0.5)

<Message Text="##teamcity[importData type='vstest' path='$(TrxFile)']" Condition="'$(TEAMCITY_VERSION)' != '' AND Exists($(TrxFile))" Importance="High" />

https://github.com/aspnet/BuildTools/blob/ef22e20aba16613f55832a91826163e2ee5f9d14/files/KoreBuild/modules/vstest/module.targets#L105

NikolayPianikov commented 6 years ago

I've found that the this logger works correctly, but TeamCity has the issue which does not allow to parse some TeamCity service messages correctly, but some others are ok. So I could create a brunch containing workaround for this issue, but would prefer do not merge it to the master brunch. This is patched logger

natemcmaster commented 6 years ago

would prefer do not merge it to the master branch.

I'm a little hesitant to rely on a custom build of the logger. This would make it hard to take new versions of the logger when you make updates to it. The fix you added in https://github.com/JetBrains/TeamCity.MSBuild.Logger/commit/d2d662c296196a1e4d06482fa9e6775e8597c024 looks good to me. What's the reason you don't want to added it to master?

NikolayPianikov commented 6 years ago

@natemcmaster we should fix it in the TeamCity agent core

natemcmaster commented 6 years ago

Hmm, maybe another solution would be to port these tasks to .NET Core as well. https://confluence.jetbrains.com/display/TCD10/MSBuild+Service+Tasks. Any idea if these tasks are being ported to support .NET Core?

NikolayPianikov commented 6 years ago

@natemcmaster I've already done fixes in TeamCity core. I could add special flag to logger to turn on workaround. About MSBuild tasks - it is good idea and easy to implement

natemcmaster commented 6 years ago

Thanks for the update @NikolayPianikov. I managed to workaround this by adding my own MSBuild task that looks like this:

using System;
using Microsoft.Build.Utilities;

namespace Microsoft.AspNetCore.BuildTools
{
    /// <summary>
    /// Writes a message to console output that does not flow through the MSBuild logger.
    /// </summary>
    public class ConsoleMessage : Task
    {
        public string Text { get; set; }

        public override bool Execute()
        {
            Console.WriteLine(Text);
            return true;
        }
    }
}
NikolayPianikov commented 6 years ago

you could add the parameter PLAIN to do not produce nested service messages For the common case will be fixed in TeamCity core