简体   繁体   中英

How to add macros to visual studio project?

I need to add a macro to a visual studio project so that i could use this macro to set properties of the project.

在此输入图像描述

eg I could replace 192.168.1.50 to a macro naming $(RemoteComputer).

Could I do this?

Two options:

  1. Make it an environment variable like PATH or APPDATA (My Computer->Properties->Advanced->Environment Variables). Note that you need to restart MSVC or it will not find the new environment variables.
  2. If you want the setting only for a single project, then open the .vcxproj file and go to Project/PropertyGroup[Label="Globals"] . Add a new tag here, eg FooBar and it will appear as a $-macro in the studio-settings for that project.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM