Dzm*_*voi 5 c# powershell building post-build-event visual-studio
我有以下post-build事件:
powershell Set-ExecutionPolicy Unrestricted
powershell -file "$(SolutionDir)Obfuscation\_obfuscate.ps1" "$(SolutionDir)" "$(ProjectDir)"
powershell Set-ExecutionPolicy Restricted
Run Code Online (Sandbox Code Playgroud)
和PS脚本开头:
param
(
[string]$slnDir,
[string]$projectDir
)
Run Code Online (Sandbox Code Playgroud)
当MSBuild试图运行它时,我的第一个参数"$(SolutionDir)"被分成两个参数,因为解决方案路径包含一个空格字符:D:\Projects\Dion2 Mercurial\repo\Dion2Web\.所以我的脚本D:\Projects\Dion2作为第一个参数和Mercurial\repo\Dion2Web\第二个参数接收.
将这些参数发送到脚本文件的正确方法是什么?
注意:当脚本只有一个参数时,这样的构建后脚本可以正常工作.
尝试调整您的构建后事件以使用以下内容:
powershell -file "$(SolutionDir)Obfuscation\_obfuscate.ps1" -slnDir '$(SolutionDir)' -projectDir '$(ProjectDir)'
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3950 次 |
| 最近记录: |