【问题标题】:How to determine output folder of dnu/dotnet publish如何确定 dnu/dotnet 发布的输出文件夹
【发布时间】:2016-08-12 08:53:23
【问题描述】:

当我使用

发布我的项目时

dotnet publish

输出到文件夹

bin/Debug/dnxcore50/osx.10.11-x64/publish

(或者可能是 Release 等价物)

是否可以为 project.json 文件中指定的发布后脚本确定此文件夹位置?

【问题讨论】:

    标签: dnx coreclr dotnet-cli


    【解决方案1】:

    感谢 dotnet/cli gitter 频道的快速响应,您可以。以下变量可用:

    %publish:ProjectPath%
    %publish:Configuration%
    %publish:OutputPath%
    %publish:TargetFramework%
    %publish:FullTargetFramework%
    %publish:Runtime%
    

    Source

    以下是用于预编译/后编译的:

    %compile:TargetFramework%
    %compile:FullTargetFramework%
    %compile:Configuration%
    %compile:OutputFile%
    %compile:OutputDir%
    %compile:ResponseFile%
    %compile:RuntimeOutputDir%
    %compile:RuntimeIdentifier%
    %compile:CompilerExitCode%     // postcompile only
    

    Source

    【讨论】:

    • 这些应该记录在某处......任何地方! project.json 是一个黑盒子,除非你能找到源代码并分析它。
    • @BradRobinson 我不明白如何使用这些变量。例如,我可以使用 <Message Text="$(OutputPath)"/> 显示 OutputPath,但不能显示您的 %compile:OutputPath%。因为我想知道如何获取 REAL OutputPath,所以如果显示它,我会得到 .\bin 而不是 .\bin\Debug\net461\win7-x64
    • @JérômeMével 以上变量用于您的project.json 文件。我不相信有办法从 MSBuild 解决 bin\Debug\net461\win7-x64。但是在project.json 中使用%compile:RuntimeOutputDir% 将解析为D:\...\<PROJECT>\bin\Debug\net461\win7-x64
    • 太酷了,谢谢,我认为我无法使用 dotnet cli 完成这项工作
    • @Robula 我刚刚找到了完整的 project.json 架构,它可能有用link
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-03-02
    • 2021-10-11
    • 1970-01-01
    • 2019-03-16
    • 2019-04-27
    • 2018-09-29
    • 1970-01-01
    相关资源
    最近更新 更多