Custom macro properties for Visual Studio properties in C #

I inherited a C # solution where projects have a customized "Command Prompt After Build" command. There are several custom property macros on this command line that copy various output files to specific folders. However, when I build any of the projects, macros are incorrectly defined as empty lines.

eg.

copy "$(TargetPath)" "$(PluginPath)\$(ConfigurationName)"

Standard macros, for example. $ (TargetPath) works fine, but I see no way to control the value of user-defined macros. At the stage after the build, there is a button "Macros →" in which standard macros are displayed, but I do not see the ability to edit their values ​​or add new user-defined macros.

It seems that the previous developer worked, so what am I missing?

I read that macros can be defined in .vsprops files, but only Visual C ++ projects support these files. When I look in the Property Manager window, I only see the message "No Visual C ++ project loaded." (I would expect custom property property macros to be equally useful in the Post-Build Command Line of C ++ projects, as they are in C # or projects in any language.)

+4
source share
2 answers

With a quick search, I found this , this may help.

Update: .csproj PluginPath copy "$(TargetPath)" "$(PluginPath)\$(ConfigurationName)" ( Visual Studio 2008)

    ...
    <PluginPath>C:\apps\</PluginPath>
</PropertyGroup>
+5

, .

  • set MY_INCLUDES_DIR = D:\MyIncludes "C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\Tools\vsvars32.bat" "C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe" D:\MySolution.sln

Visual Studio, . - .

  1. xml visual studio.

    <PropertyGroup>
        <MY_INCLUDES_DIR>D:\MyIncludes\</MY_INCLUDES_DIR>
    </PropertyGroup>
    Hide result
     
  2. MY_INCLUDES_DIR $(MY_INCLUDES_DIR) .

+1

Source: https://habr.com/ru/post/1545042/


All Articles