我有以下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\第二个参数接收.
将这些参数发送到脚本文件的正确方法是什么?
注意:当脚本只有一个参数时,这样的构建后脚本可以正常工作.
如何从命令行预构建或后构建窗口中检测调试或释放模式?
我测试了下面的代码,它在代码文本窗口中工作.它可以转换为命令行代码吗?如果可以,怎么做,谢谢.
bool debugging = false;
#if DEBUG
debugging = true;
// do something like to move ../debug/bin/ to somewhere.
#else
debugging = false;
// do something like to move ../debug/bin/ to somewhere.
#endif
Console.WriteLine(debugging);
Run Code Online (Sandbox Code Playgroud)