Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 268
Andrey Avatar asked Dec 06 '11 03:12

Andrey


People also ask

How to use Post build event in Visual Studio?

In the Post-build event command line box, specify the syntax of the build event. Add a call statement before all post-build commands that run . bat files. For example, call C:\MyFile.

What is post build event?

Post-build event will only run when the compiler's output file (.exe or . dll) is different than the previous compiler output file. Thus, a post-build event is not run if a project is up-to-date.

How do I open a build event in Visual Studio?

Go to the Solution Explorer the right-click the project then select Properties then go to the Build Events tab. Now if you build the project based upon the selection of configuration name , the Web. config file will be updated.

What is post build?

Post build is used to update parts of the configuration after compile time and is typically used by the OEM. The post build parameters are located in a separate memory area which may be replaced by a new configuration that may be downloaded independently of the other parts for the ECU software.


1 Answers

Just figured out:

if not $(ConfigurationName) == Debug  
   copy /y $(ProjectDir)memcached.$(ConfigurationName).config 
           $(ProjectDir)memcached.config
like image 149
Andrey Avatar answered Sep 21 '22 15:09

Andrey