Visual Studio Post Build不喜欢我的条件 [英] Visual Studio Post Build does not like my conditional

查看:65
本文介绍了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

这篇关于Visual Studio Post Build不喜欢我的条件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆