最近困惑于C#工程Properties中的某些项中Configuration和Platform不可选择(比如Build Events选项卡,如图一),但是又需要根据这两项设置进行区分对待,于是google了以下方案:
图一
这些command line是作为batch脚本文件被执行的,我们可以在脚本中添加条件语句进行区分对待:
1. 将下面的if else语句写在同一行
if $(ConfigurationName)==Debug (
copy "$(TargetDir)myapp.dll" "c:\delivery\bin" /y
copy "$(TargetDir)myapp.dll.config" "c:\delivery\bin" /y
) ELSE (
echo "we do something different here".
)
2.这种方法没试过,有兴趣的可以试试
if $(ConfigurationName) == Debug goto :debug
:release
signtool.exe ....
xcopy ...
goto :exit
:debug
' debug items in here
:exit