Visual Studio Post Build不喜欢我的条件
我有一个类似以下内容的构建条件:
I have a post build conditional that looks like this:
if $(ConfigurationName)==Release
(
echo Update $(TargetName) to be non conflicting
"$(SolutionDir)ILMerge\RummageTypeRenamer.exe" -f XamlGeneratedNamespace.GeneratedInternalTypeHelper -t XamlGeneratedNamespace.GeneratedInternalTypeHelper$(TargetName) $(TargetName).dll
del $(TargetName).dll
ren $(TargetName).Runmage.dll $(TargetName).dll
)
如果我摘下病情和原谅,这很好.但是,如果我按原样运行,则会收到错误消息:
This runs fine if I take off the condition and the parens. But if I run it as is, I get the error:
该命令的语法不正确.
The syntax of the command is incorrect.
然后打印出整个语句,条件看起来不错:
The whole statement then prints out, and the conditional looks good:
如果Release == Release
if Release==Release
为什么Visual Studio不喜欢我的条件条件?
Why doesn't Visual Studio like my conditional?
在这里找到了解决方案:如何运行Visual仅适用于调试构建的Studio生成后事件(请参阅以下注释:我发现整个命令需要在一行上,否则您将获得以代码255退出")
found the solution here: How to run Visual Studio post-build events for debug build only (see this comment: I've found that the entire command needs to be on one line or you'll get "exited with code 255" )
因此您的帖子构建应如下所示:
So your post build should look like:
if $(ConfigurationName)==Release goto _release
goto _exit
:_release
echo Update $(TargetName) to be non conflicting
"$(SolutionDir)ILMerge\RummageTypeRenamer.exe" -f XamlGeneratedNamespace.GeneratedInternalTypeHelper -t XamlGeneratedNamespace.GeneratedInternalTypeHelper$(TargetName) $(TargetName).dll
del $(TargetName).dll
ren $(TargetName).Runmage.dll $(TargetName).dll
:_exit