3

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:

if Release==Release

Why doesn't Visual Studio like my conditional?

Vaccano
  • 78,325
  • 149
  • 468
  • 850
  • batch expected the parenthesis on the same line as the `IF` – jeb Oct 18 '13 at 05:37
  • (+1) for showing how to use RummageTypeRenamer in post-build :). I know that this is out of the scope of the topic, but still people are able to search this with "RummageTypeRenamer post-build" search string. Why did you need this assembly only for Release mode? Why not Debug? If you want i can ask a separate question and notify here. Thanks. – Andrey K. Nov 29 '16 at 17:03
  • @AndreyK. - sorry to say that I don't recall why I needed this. – Vaccano Nov 29 '16 at 21:49

2 Answers2

2

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
Community
  • 1
  • 1
Nini75
  • 29
  • 2
0

Try the K&R style parens:

if $(ConfigurationName)==Release (
    echo Update $(TargetName) to be non conflicting
    ...
)
Ed Chapel
  • 6,842
  • 3
  • 30
  • 44