|
1 | 1 | ---
|
2 | 2 | title: "How to: Integrate Custom Tools into the Project Properties"
|
3 |
| -ms.date: "05/16/2019" |
4 |
| -helpviewer_keywords: ["msbuild (c++), howto: integrate custom tools"] |
5 |
| -ms.assetid: f32d91a4-44e9-4de3-aa9a-1c7f709ad2ee |
| 3 | +description: "How to integrate custom tools into the Project Properties in Visual Studio C++ projects." |
| 4 | +ms.date: 10/08/2020 |
| 5 | +helpviewer_keywords: ["MSBuild (C++), howto: integrate custom tools"] |
6 | 6 | ---
|
7 | 7 | # How to: Integrate Custom Tools into the Project Properties
|
8 | 8 |
|
9 |
| -You can add custom tool options to the Visual Studio **Property Pages** window by creating an underlying XML schema file. |
| 9 | +You can add custom tool options to the Visual Studio **Property Pages** window by creating an XML file. |
10 | 10 |
|
11 |
| -The **Configuration Properties** section of the **Property Pages** window displays setting groups that are known as *rules*. Every rule contains the settings for a tool or a group of features. For example, the **Linker** rule contains the settings for the linker tool. The settings in a rule can be subdivided into *categories*. |
| 11 | +The **Configuration Properties** section of the **Property Pages** window displays setting groups known as *rules*. Every rule contains the settings for a tool or a group of features. For example, the **Linker** rule contains the settings for the linker tool. The settings in a rule can be subdivided into *categories*. |
12 | 12 |
|
13 |
| -This document explains how to create a file in a set directory that contains properties for your custom tool so that the properties are loaded when Visual Studio starts. For information about how to modify the file, see [Platform Extensibilty Part 2](/archive/blogs/vsproject/platform-extensibility-part-2) on the Visual Studio Project Team blog. |
| 13 | +You can create a rule file that contains properties for your custom tool so that the properties are loaded when Visual Studio starts. For information about how to modify the file, see [Platform Extensibility Part 2](/archive/blogs/vsproject/platform-extensibility-part-2) on the Visual Studio Project Team blog. |
| 14 | + |
| 15 | +::: moniker range="vs-2015" |
| 16 | + |
| 17 | +The folder to place your rule file in depends on the locale and the version of Visual Studio in use. In a Visual Studio 2015 or earlier developer command prompt, the rules folder is *`%ProgramFiles(x86)%\MSBuild\Microsoft.Cpp\v4.0\<version>\<locale>`*. The `<version>` value is *`v140`* in Visual Studio 2015. The `<locale>` is an LCID, for example, `1033` for English. You'll use a different path for each edition of Visual Studio that's installed, and for each language. For example, the default rules folder path for Visual Studio 2015 Community edition in English could be *`C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\v140\1033\`*. |
| 18 | + |
| 19 | +::: moniker-end |
| 20 | + |
| 21 | +::: moniker range="vs-2017" |
| 22 | + |
| 23 | +The folder to place your rule file in depends on the locale and the version of Visual Studio in use. In a Visual Studio 2017 developer command prompt, the rules folder is *`%VSINSTALLDIR%Common7\IDE\VC\VCTargets\<locale>\`*. The `<locale>` is an LCID, for example, `1033` for English. In a Visual Studio 2015 or earlier developer command prompt, the rules folder is *`%ProgramFiles(x86)%\MSBuild\Microsoft.Cpp\v4.0\<version>\<locale>\`*, where the `<version>` value is *`v140`* in Visual Studio 2015. You'll use a different path for each edition of Visual Studio that's installed, and for each language. For example, the default rules folder path for Visual Studio 2017 Community edition in English could be *`C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\VC\VCTargets\1033\`*. |
| 24 | + |
| 25 | +::: moniker-end |
| 26 | + |
| 27 | +::: moniker range=">=vs-2019" |
| 28 | + |
| 29 | +The folder to place your rule file in depends on the locale and the version of Visual Studio in use. In a Visual Studio 2019 or later developer command prompt, the rules folder is *`%VSINSTALLDIR%MSBuild\Microsoft\VC\<version>\<locale>\`*, where the `<version>` value is *`v160`* in Visual Studio 2019. The `<locale>` is an LCID, for example, `1033` for English. In Visual Studio 2017, the rules folder is *`%VSINSTALLDIR%Common7\IDE\VC\VCTargets\<locale>\`*. In a Visual Studio 2015 or earlier developer command prompt, the rules folder is *`%ProgramFiles(x86)%\MSBuild\Microsoft.Cpp\v4.0\<version>\<locale>\`*. You'll use a different path for each edition of Visual Studio that's installed, and for each language. For example, the default rules folder path for Visual Studio 2019 Community edition in English could be *`C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\1033\`*. |
| 30 | + |
| 31 | +::: moniker-end |
14 | 32 |
|
15 | 33 | ### To add or change project properties
|
16 | 34 |
|
17 | 35 | 1. In the XML editor, create an XML file.
|
18 | 36 |
|
19 |
| -1. Save the file in the Visual Studio `VCTargets\1033` folder. You will have a different path for each edition of Visual Studio that is installed and each language. For example, the default folder path for Visual Studio 2019 Community edition in English is `C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\VC\VCTargets`. Adjust the path for your language and Visual Studio edition. Every rule in the **Property Pages** window is represented by an XML file in this folder. Make sure that the file is uniquely named in the folder. |
| 37 | +1. Save the file in the default rules folder. Adjust the path for your language and Visual Studio edition. Every rule in the **Property Pages** window is represented by an XML file in this folder. Make sure that the file is uniquely named in the folder. |
20 | 38 |
|
21 |
| -1. Copy the content of `%ProgramFiles%\Microsoft Visual Studio\2019\<VS Edition>\Common7\IDE\VC\VCTargets\<LCID>\cl.xml` (or whatever your path is), close it without saving changes, and then paste the content in your new XML file. You can use any XML schema file - this is just one that can be used so you start with a template. |
| 39 | +1. Copy the content of an existing rules file, such as *`rc.xml`*, close it without saving changes, and then paste the content in your new XML file. You can copy any XML schema file to use as a template. Choose one that's similar to your tool. |
22 | 40 |
|
23 | 41 | 1. In the new XML file, modify the content according to your requirements. Make sure to change the **Rule Name** and **Rule.DisplayName** at the top of the file.
|
24 | 42 |
|
25 |
| -1. Save the changes and close the file. |
| 43 | +1. Save your changes and close the file. |
26 | 44 |
|
27 |
| -1. The XML files in `%ProgramFiles%\Microsoft Visual Studio\2019\<VS Edition>\Common7\IDE\VC\VCTargets\<LCID>` (or wherever you saved them) are loaded when Visual Studio starts. Therefore, to test the new file, restart Visual Studio. |
| 45 | +1. The XML files in the rules folder are loaded when Visual Studio starts. To test the new file, restart Visual Studio. |
28 | 46 |
|
29 |
| -1. In **Solution Explorer**, right-click a project and then click **Properties**. In the **Property Pages** window, in the left pane, verify that there is a new node with the name of your Rule. |
| 47 | +1. In **Solution Explorer**, right-click a project and then choose **Properties**. In the **Property Pages** window, verify that there's a new node with the name of your rule. |
30 | 48 |
|
31 | 49 | ## See also
|
32 | 50 |
|
|
0 commit comments