You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Common macros for MSBuild commands and properties
@@ -14,9 +14,9 @@ To display all of the currently available macros, open the project property page
14
14
15
15
For example, in the left pane, select **Configuration Properties** > **VC++ Directories**, and then in the right pane, select **Include directories**. The value for **Include directories** is `$(VC_IncludePath);$(WindowsSDK_IncludePath);`.
16
16
17
-
The dollar sign and parenthesis surrounding these two values indicates that they are macros. The expansion of those two macros sets the include directories to search.
17
+
The dollar sign and parenthesis surrounding these two values indicates that they're macros. The expansion of those two macros sets the include directories to search.
18
18
19
-
Select **Include Directories** and a dropdown will appear at the end of the row. Select the dropdown button, then select **Edit**. In the **Include Directories** dialog box that appears, select the **Macros>>** button.
19
+
Select **Include Directories** and a dropdown appears at the end of the row. Select the dropdown button, then select **Edit**. In the **Include Directories** dialog box that appears, select the **Macros>>** button.
20
20
21
21
That expands the dialog to show the current set of properties and macros visible to Visual Studio, along with the current value for each. For more information, see the **Specifying User-Defined Values** section of [C++ project property page reference](property-pages-visual-cpp.md).
22
22
@@ -31,29 +31,29 @@ This table describes a commonly used subset of the available macros; there are m
31
31
| Macro | Description |
32
32
|--|--|
33
33
|**`$(Configuration)`**| The name of the current project configuration, for example, "Debug". |
34
-
|**`$(DevEnvDir)`**| The installation directory of Visual Studio (defined as drive + path); includes the trailing backslash '\\'. |
34
+
|**`$(DevEnvDir)`**| The installation directory of Visual Studio (defined as drive + path); includes the trailing backslash (\\). |
35
35
|**`$(FrameworkDir)`**| The directory into which the .NET Framework was installed. |
36
-
|**`$(FrameworkSDKDir)`**| The directory into which you installed the .NET Framework. The .NET Framework could have been installed as part of Visual Studio or separately. |
36
+
|**`$(FrameworkSDKDir)`**| The directory into which you installed the .NET Framework. The .NET Framework may have been installed as part of Visual Studio or separately. |
37
37
|**`$(FrameworkVersion)`**| The version of the .NET Framework used by Visual Studio. Combined with **`$(FrameworkDir)`**, the full path to the version of the .NET Framework use by Visual Studio. |
38
38
|**`$(FxCopDir)`**| The path to the *`fxcop.cmd`* file. The *`fxcop.cmd`* file isn't installed in all Visual Studio editions. |
39
-
|**`$(IntDir)`**| Path to the directory specified for intermediate files. If it's a relative path, intermediate files go to this path appended to the project directory. This path should have a trailing slash. It resolves to the value for the **Intermediate Directory** property. Don't use **`$(OutDir)`** to define this property. |
40
-
|**`$(OutDir)`**| Path to the output file directory. If it's a relative path, output files go to this path appended to the project directory. This path should have a trailing slash. It resolves to the value for the **Output Directory** property. Don't use **`$(IntDir)`** to define this property. |
39
+
|**`$(IntDir)`**| Path to the directory specified for intermediate files. If it's a relative path, intermediate files go to this path appended to the project directory. This path should have a trailing backslash (\\). It resolves to the value for the **Intermediate Directory** property. Don't use **`$(OutDir)`** to define this property. |
40
+
|**`$(OutDir)`**| Path to the output file directory. If it's a relative path, output files go to this path appended to the project directory. This path should have a trailing backslash (\\). It resolves to the value for the **Output Directory** property. Don't use **`$(IntDir)`** to define this property. |
41
41
|**`$(Platform)`**| The name of current project platform, for example, "Win32". |
42
42
|**`$(PlatformShortName)`**| The short name of current architecture, for example, "x86" or "x64". |
43
-
|**`$(ProjectDir)`**| The directory of the project (defined as drive + path); includes the trailing backslash '\\'. |
43
+
|**`$(ProjectDir)`**| The directory of the project (defined as drive + path); includes the trailing backslash (\\). |
44
44
|**`$(ProjectExt)`**| The file extension of the project. It includes the '.' before the file extension. |
45
45
|**`$(ProjectFileName)`**| The file name of the project (defined as base name + file extension). |
46
46
|**`$(ProjectName)`**| The base name of the project. |
47
47
|**`$(ProjectPath)`**| The absolute path name of the project (defined as drive + path + base name + file extension). |
48
-
|**`$(PublishDir)`**| The output location for the publish target; includes the trailing backslash '\\'. Defaults to the **`$(OutDir)app.publish\`** folder. |
48
+
|**`$(PublishDir)`**| The output location for the publish target; includes the trailing backslash (\\). Defaults to the **`$(OutDir)app.publish\`** folder. |
49
49
|**`$(RemoteMachine)`**| Set to the value of the **Remote Machine** property on the Debug property page. For more information, see [Changing Project Settings for a C/C++ Debug Configuration](/visualstudio/debugger/project-settings-for-a-cpp-debug-configuration). |
50
50
|**`$(RootNameSpace)`**| The namespace, if any, containing the application. |
51
-
|**`$(SolutionDir)`**| The directory of the solution (defined as drive + path); includes the trailing backslash '\\'. Defined only when building a solution in the IDE. |
51
+
|**`$(SolutionDir)`**| The directory of the solution (defined as drive + path); includes the trailing backslash (\\). Defined only when building a solution in the IDE. |
52
52
|**`$(SolutionExt)`**| The file extension of the solution. It includes the '.' before the file extension. Defined only when building a solution in the IDE. |
53
53
|**`$(SolutionFileName)`**| The file name of the solution (defined as base name + file extension). Defined only when building a solution in the IDE. |
54
54
|**`$(SolutionName)`**| The base name of the solution. Defined only when building a solution in the IDE. |
55
55
|**`$(SolutionPath)`**| The absolute path name of the solution (defined as drive + path + base name + file extension). Defined only when building a solution in the IDE. |
56
-
|**`$(TargetDir)`**| The directory of the primary output file for the build (defined as drive + path); includes the trailing backslash '\\'. |
56
+
|**`$(TargetDir)`**| The directory of the primary output file for the build (defined as drive + path); includes the trailing backslash (\\). |
57
57
|**`$(TargetExt)`**| The file extension of the primary output file for the build. It includes the '.' before the file extension. |
58
58
|**`$(TargetFileName)`**| The file name of the primary output file for the build (defined as base name + file extension). |
59
59
|**`$(TargetName)`**| The base name of the primary output file for the build. |
@@ -65,19 +65,19 @@ This table describes a commonly used subset of the available macros; there are m
65
65
66
66
## Obsolete macros
67
67
68
-
The build system for C++ was changed significantly between Visual Studio 2008 and Visual Studio 2010. Many macros used in earlier project types have been changed to new ones. These macros are no longer used or have been replaced by one or more equivalent properties or [item metadata macro](/visualstudio/msbuild/itemmetadata-element-msbuild) (**`%(item-name)`**) values. Macros marked "migrated" can be updated by the project migration tool. If a project containing the macro is migrated from Visual Studio 2008 or earlier to Visual Studio 2010, Visual Studio converts the macro to the equivalent current macro. Later versions of Visual Studio can't convert projects from Visual Studio 2008 and earlier to the new project type. You must convert these projects in two steps; first convert them to Visual Studio 2010, and then convert the result to your newer version of Visual Studio. For more information, see [Overview of potential upgrade issues](../../porting/overview-of-potential-upgrade-issues-visual-cpp.md).
68
+
The build system for C++ was changed significantly between Visual Studio 2008 and Visual Studio 2010. Many macros used in earlier project types changed to new ones. These macros are no longer used or are replaced by one or more equivalent properties or [item metadata macro](/visualstudio/msbuild/itemmetadata-element-msbuild) (**`%(item-name)`**) values. The migration tool can update macros marked "migrated". If a project containing the macro is migrated from Visual Studio 2008 or earlier to Visual Studio 2010, Visual Studio converts the macro to the equivalent current macro. Later versions of Visual Studio can't convert projects from Visual Studio 2008 and earlier to the new project type. You must convert these projects in two steps; first convert them to Visual Studio 2010, and then convert the result to your newer version of Visual Studio. For more information, see [Overview of potential upgrade issues](../../porting/overview-of-potential-upgrade-issues-visual-cpp.md).
69
69
70
70
| Macro | Description |
71
71
|--|--|
72
-
|**`$(InputDir)`**| (Migrated.) The directory of the input file (defined as drive + path); includes the trailing backslash '\\'. If the project is the input, then this macro is equivalent to **`$(ProjectDir)`**. |
72
+
|**`$(InputDir)`**| (Migrated.) The directory of the input file (defined as drive + path); includes the trailing backslash (\\). If the project is the input, then this macro is equivalent to **`$(ProjectDir)`**. |
73
73
|**`$(InputExt)`**| (Migrated.) The file extension of the input file. It includes the '.' before the file extension. If the project is the input, then this macro is equivalent to **`$(ProjectExt)`**. For source files, it's equivalent to **`%(Extension)`**. |
74
74
|**`$(InputFileName)`**| (Migrated.) The file name of the input file (defined as base name + file extension). If the project is the input, then this macro is equivalent to **`$(ProjectFileName)`**. For source files, it's equivalent to **`%(Identity)`**. |
75
75
|**`$(InputName)`**| (Migrated.) The base name of the input file. If the project is the input, then this macro is equivalent to **`$(ProjectName)`**. For source files, it's equivalent to **`%(Filename)`**. |
76
76
|**`$(InputPath)`**| (Migrated.) The absolute path name of the input file (defined as drive + path + base name + file extension). If the project is the input, then this macro is equivalent to **`$(ProjectPath)`**. For source files, it's equivalent to **`%(FullPath)`**. |
77
77
|**`$(ParentName)`**| Name of the item containing this project item. This macro is the parent folder name, or project name. |
78
78
|**`$(SafeInputName)`**| The name of the file as a valid class name, minus file extension. This property doesn't have an exact equivalent. |
79
79
|**`$(SafeParentName)`**| The name of the immediate parent in valid name format. For example, a form is the parent of a *`.resx`* file. This property doesn't have an exact equivalent. |
80
-
|**`$(SafeRootNamespace)`**| The namespace name in which the project wizards will add code. This namespace name only contains characters that would be permitted in a valid C++ identifier. This property doesn't have an exact equivalent. |
80
+
|**`$(SafeRootNamespace)`**| The namespace name where the project wizards should add code. This namespace name only contains characters that would be permitted in a valid C++ identifier. This property doesn't have an exact equivalent. |
The C++ Standard defines a common set of attributes. It also allows compiler vendors to define their own attributes within a vendor-specific namespace. However, compilers are only required to recognize the attributes defined in the standard.
@@ -134,14 +135,14 @@ The first call to `foo`, and both calls to `bar`, are treated as if they were de
134
135
135
136
### `[[msvc::intrinsic]]`
136
137
137
-
The Microsoft-specific `[[msvc::intrinsic]]` attribute tells the compiler to inline a metafunction that acts as a named cast from the parameter type to the return type. When the attribute is present on a function definition, the compiler replaces all calls to that function with a simple cast. The `[[msvc::intrinsic]]` attribute is available in Visual Studio 2022 version 17.5 preview 2 and later versions. This attribute applies only to the specific function that follows it.
138
-
139
138
The `[[msvc::intrinsic]]` attribute has three constraints on the function it's applied to:
140
139
141
-
- The function can't be recursive; its body must only have a return statement with a cast.
140
+
- The function can't be recursive; its body must only have a return statement with a `static_cast` from the parameter type to the return type.
142
141
- The function can only accept a single parameter.
143
142
- The **`/permissive-`** compiler option is required. (The **`/std:c++20`** and later options imply **`/permissive-`** by default.)
144
143
144
+
The Microsoft-specific `[[msvc::intrinsic]]` attribute tells the compiler to inline a metafunction that acts as a named cast from the parameter type to the return type. When the attribute is present on a function definition, the compiler replaces all calls to that function with a simple cast. The `[[msvc::intrinsic]]` attribute is available in Visual Studio 2022 version 17.5 preview 2 and later versions. This attribute applies only to the specific function that follows it.
145
+
145
146
#### Example
146
147
147
148
In this sample code, the `[[msvc::intrinsic]]` attribute applied to the `my_move` function makes the compiler replace calls to the function with the inlined static cast in its body:
0 commit comments