Log the warning messages into a text file from a cake script for DotNetCoreBuild

274 Views Asked by At

Is it possible to do the same thing as here but for DotNetCoreBuild? If yes, how?

This workaround is not suitable, because I need to execute a next target and I need those logs after build step.

1

There are 1 best solutions below

0
On BEST ANSWER
var target = Argument("target", "Build");

var slnPath = "./src/some-project.sln";
var distDirectory = Directory("./dist");

Task("Build")
    .Does(() =>
    {
        var settings = new DotNetCoreMSBuildSettings();
        settings.FileLoggers.Add(new MSBuildFileLoggerSettings(){
            LogFile = "./WarningReportes.txt",
            SummaryOutputLevel = MSBuildLoggerOutputLevel.WarningsOnly
        });
        DotNetCoreMSBuild(slnPath, settings);
    });


RunTarget(target);