1
project.json
文件可以包含prepublish
條目,以在發佈包之前執行一些腳本。有幾個變量,這些腳本可用,根據自己wiki,例如%project:Directory%
在ASP.NET5的預發佈腳本中訪問輸出目錄
"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%" ]
}