【问题标题】:Redirect MSBuild output path when using Cake使用 Cake 时重定向 MSBuild 输出路径
【发布时间】:2018-09-26 06:38:14
【问题描述】:

来自 Fake 我习惯将 csproj 文件的标准输出保存到 bin/debug 以便能够在本地调试。但是在运行我的构建脚本时,我希望将文件编译到 /bin/build 以创建安装脚本或 nuget 包。

我用蛋糕试过了,但没有成功:

Task("Build")
.DoesForEach( GetFiles ("**/*.sln" ), (sln) =>
   var settings = new MSBuildSettings()
    .WithProperty("OutputPath", buildDir);
   MSBuild(sln, settings);
});

它为 MSBuild 产生正确的调用

"C:/.../MSBuild.exe" /v:normal /p:OutputPath=bin/build /target:Build ...

但不幸的是,目标目录是空的? 我错过了什么吗?

提前致谢

【问题讨论】:

    标签: c# msbuild cakebuild


    【解决方案1】:

    OutputPath 需要是绝对路径,试试这样的:

    Task("Build")
    .DoesForEach( GetFiles ("**/*.sln" ), (sln) =>
        DirectoryPath buildDir = MakeAbsolute(Directory("./bin/build"));
        // Use MSBuild
        var settings = new MSBuildSettings()
                            .WithProperty("OutputPath", buildDir.FullPath);
        MSBuild(sln, settings);
    });
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-03-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-05-01
      • 1970-01-01
      相关资源
      最近更新 更多