"If" syntax for post-build macros in VS 2010

Andrey picture Andrey · Dec 6, 2011 · Viewed 7.5k times · Source

I'm trying to to add a post-build macro that would conditionally copy some files after the build if the configuration is not "Debug". I'm trying the following:

if ('$(ConfigurationName)' <> 'Debug')
    copy /y $(ProjectDir)memcached.$(ConfigurationName).config   
            $(ProjectDir)memcached.config 

And I get error 255. What should be the right syntax for the 'if' statement?

Answer

Andrey picture Andrey · Dec 6, 2011

Just figured out:

if not $(ConfigurationName) == Debug  
   copy /y $(ProjectDir)memcached.$(ConfigurationName).config 
           $(ProjectDir)memcached.config