【发布时间】:2016-08-12 08:53:23
【问题描述】:
当我使用
发布我的项目时dotnet publish
输出到文件夹
bin/Debug/dnxcore50/osx.10.11-x64/publish
(或者可能是 Release 等价物)
是否可以为 project.json 文件中指定的发布后脚本确定此文件夹位置?
【问题讨论】:
标签: dnx coreclr dotnet-cli
当我使用
发布我的项目时dotnet publish
输出到文件夹
bin/Debug/dnxcore50/osx.10.11-x64/publish
(或者可能是 Release 等价物)
是否可以为 project.json 文件中指定的发布后脚本确定此文件夹位置?
【问题讨论】:
标签: dnx coreclr dotnet-cli
感谢 dotnet/cli gitter 频道的快速响应,您可以。以下变量可用:
%publish:ProjectPath%
%publish:Configuration%
%publish:OutputPath%
%publish:TargetFramework%
%publish:FullTargetFramework%
%publish:Runtime%
以下是用于预编译/后编译的:
%compile:TargetFramework%
%compile:FullTargetFramework%
%compile:Configuration%
%compile:OutputFile%
%compile:OutputDir%
%compile:ResponseFile%
%compile:RuntimeOutputDir%
%compile:RuntimeIdentifier%
%compile:CompilerExitCode% // postcompile only
【讨论】:
project.json 是一个黑盒子,除非你能找到源代码并分析它。
<Message Text="$(OutputPath)"/> 显示 OutputPath,但不能显示您的 %compile:OutputPath%。因为我想知道如何获取 REAL OutputPath,所以如果显示它,我会得到 .\bin 而不是 .\bin\Debug\net461\win7-x64
project.json 文件。我不相信有办法从 MSBuild 解决 bin\Debug\net461\win7-x64。但是在project.json 中使用%compile:RuntimeOutputDir% 将解析为D:\...\<PROJECT>\bin\Debug\net461\win7-x64