Visual studio post build don't like my conditional

I have a post post 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 is normal if I remove the condition and the parence. But if I run it as is, I get an error:

Command syntax is invalid.

Then the whole instruction is output, and the conditional expression looks good:

if Release == Release

Why is Visual Studio not my conditional?

+3
visual-studio visual-studio-2012 batch-file post-build-event
source share
2 answers

found a solution here: How to fire Visual Studio post-build events only for debug builds (see this comment: I found that the whole command should be on one line or you will get "output with code 255")

So your post build should look like this:

  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 
+2
source share

Try pairing K & R style elements:

 if $(ConfigurationName)==Release ( echo Update $(TargetName) to be non conflicting ... ) 
0
source share

All Articles