在 ASP.NET5 中访问预发布脚本中的输出目录

Access output directory in prepublish script in ASP.NET5

project.json 文件可以包含一个 prepublish 条目以在发布包之前执行一些脚本。根据它们的 wiki,这些脚本中有几个变量可用,例如 %project:Directory%

"scripts": {
  "prepublish": [ "dir %project:Directory%" ]
}

有没有办法访问用于发布的输入输出目录?我在 visual studio 中看到实际路径:

Publishing files to E:\Projects\WebPlatform\artifacts\bin\DemoLauncher\Release\PublishOutput
Executing command ["C:\Program Files (x86)\IIS\Microsoft Web Deploy V3\msdeploy.exe" -source:contentPath='C:\Users\xxxxx\AppData\Local\Temp\PublishTemp\DemoLauncher70\' -dest:contentPath='E:\Projects\WebPlatform\artifacts\bin\DemoLauncher\Release\PublishOutput' 

但是我似乎无法在 "prepublish" 脚本中获取值。我想要这样的东西:

"scripts": {
  "prepublish": [ "dir %outputDirectory%" ]
}

事实证明 dnx/dnu 发布命令不支持此功能,但是命令将替换为 dotnet publish,后者将提供 publish:OutputPath 变量。

is available here and relevant code here

的门票