Setting environment variables in pre-build event and using in compilation step

It’s 11 years later than when this question was originally asked. I am using VS 2019

if in the event you want to assign variables in your event like….

set ABC=123

Then you can’t use $(ABC) as the $(ABC) is processed before it is handed to the command line to run.

You must use %ABC% as used by the command line. It doesnt know what $(ABC) is as it is only understood by visual studio.

To Further complicate things visual studio event editor uses % as an escape char. Ive noticed things starting %D are bad, %K, %Z and %K are good.

Apparently you can use %25 as the escape for %.

%DESTDIR% doesnt as the escaping garbles it – so changing it to %25DESDIR%25 fixes it.

Leave a Comment