using $(ProjectName) in strings like LPCTSTR ?

Category: visual studio vc


Uani on Sun, 06 Apr 2014 20:46:50


is it possible, in Visual Studio Express 2013 for Windows Desktop, to use the project name in strings like

LPCTSTR mystring = TEXT(projectnamereference);
/* projectnamereference is the Projects name (as a quoted string) */


If yes, how?



Jack Zhai-MSFT on Tue, 08 Apr 2014 07:51:27

Hi Uani,

I am moving your thread into the Visual C++ Forum for dedicated support. Thanks for your understanding.

Best Regards,

Mike Danes on Tue, 08 Apr 2014 08:02:06

There's not direct access to MSBUILD properties but you could use a preprocessor definition to achieve this. In Project Properties, Configuration Properties, C/C++, Preprocessor, Preprocessor Definitions add PROJECT_NAME="$(ProjectName)". Then you can use PROJECT_NAME in code:


Uani on Tue, 08 Apr 2014 12:36:38

Thank you very much, this will do!

Uani on Tue, 08 Apr 2014 12:39:25

Thank you very much, this will do!