Kostya Vyrodov
Kostya Vyrodov

Reputation: 7277

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

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.

Upvotes: 0

Views: 272

Answers (1)

Kostya Vyrodov
Kostya Vyrodov

Reputation: 7277

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);

Upvotes: 2

Related Questions