• Icon: New Feature New Feature
    • Resolution: Unresolved
    • Icon: Minor Minor
    • ansicolor-plugin
    • Windows 2012 Server, Jenkins running as Service. Jenkins 1.621, Chrome 44.0.2403.125m (64 bit)

      I've been trying to get this plugin to work for msbuild output but I've been unable to figure out a set of options that would work. If it IS possible to do this already, could someone provide step by step instructions. If not, would you consider this in the future?

          [JENKINS-29758] Please support msbuild output.

          I don't think MSBuild itself supports outputting the SGR control sequences that ansicolor-plugin would recognize. The Microsoft.Build.Logging.ConsoleLogger class only sets Console.ForegroundColor or Console.BackgroundColor, and the .NET Framework on Windows implements those by calling SetConsoleTextAttribute, not by outputting characters.

          If you were running MSBuild on .NET Core Framework on Unix, then the System.Console class would output SGR control sequences, and it should just work.

          I think you can implement it on Windows by deriving a custom logger class from Microsoft.Build.Logging.ConsoleLogger, making its constructor call the ConsoleLogger(LoggerVerbosity, WriteHandler, ColorSetter, ColorResetter) constructor with delegates that output the SGR control sequences, and passing the name of the custom logger class to the MSBuild.exe /logger option.

          Kalle Niemitalo added a comment - I don't think MSBuild itself supports outputting the SGR control sequences that ansicolor-plugin would recognize. The Microsoft.Build.Logging.ConsoleLogger class only sets Console.ForegroundColor or Console.BackgroundColor, and the .NET Framework on Windows implements those by calling SetConsoleTextAttribute, not by outputting characters. If you were running MSBuild on .NET Core Framework on Unix, then the System.Console class would output SGR control sequences, and it should just work. I think you can implement it on Windows by deriving a custom logger class from Microsoft.Build.Logging.ConsoleLogger, making its constructor call the ConsoleLogger(LoggerVerbosity, WriteHandler, ColorSetter, ColorResetter) constructor with delegates that output the SGR control sequences, and passing the name of the custom logger class to the MSBuild.exe /logger option.

          My previous comment applies to MSBuild 14. In MSBuild 15, the /consoleloggerparameters:ForceConsoleColor option should do the trick.

          Kalle Niemitalo added a comment - My previous comment applies to MSBuild 14. In MSBuild 15, the /consoleloggerparameters:ForceConsoleColor option should do the trick.

            Unassigned Unassigned
            mattisking Matt Philmon
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: