将警告消息从DotNetCoreBuild的蛋糕脚本记录到文本文件中

时间:2018-11-01 16:23:04

标签: logging .net-core cakebuild

是否可以执行与here相同的操作,但对于DotNetCoreBuild? 如果是,怎么办?

This workaround不适合,因为我需要执行下一个目标,并且在构建步骤之后需要这些日志。

1 个答案:

答案 0 :(得分:2)

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