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
helpviewer_keywords: ["cl.exe compiler, common language runtime option", "-clr compiler option [C++]", "clr compiler option [C++]", "/clr compiler option [C++]", "Managed Extensions for C++, compiling", "common language runtime, /clr compiler option"]
7
7
ms.assetid: fec5a8c0-40ec-484c-a213-8dec918c1d6c
8
8
---
9
9
# `/clr` (Common Language Runtime Compilation)
10
10
11
-
Enables applications and components to use features from the common language runtime (CLR).
11
+
Enables applications and components to use features from the common language runtime (CLR) and enables C++/CLI compilation.
12
12
13
13
## Syntax
14
14
@@ -21,7 +21,15 @@ One or more of the following comma-separated arguments.
21
21
22
22
- none
23
23
24
-
With no options, **`/clr`** creates metadata for the application. The metadata can be consumed by other CLR applications, and enables the application to consume types and data in the metadata of other CLR components. For more information, see [Mixed (Native and Managed) Assemblies](../../dotnet/mixed-native-and-managed-assemblies.md).
24
+
With no options, **`/clr`** creates metadata for the component. The metadata can be consumed by other CLR applications, and enables the component to consume types and data in the metadata of other CLR components. For more information, see [Mixed (Native and Managed) Assemblies](../../dotnet/mixed-native-and-managed-assemblies.md).
25
+
26
+
-**`NetCore`**
27
+
28
+
**`/clr:NetCore`** creates metadata and code for the component using the latest cross-platform .NET framework, also known as .NET Core. The metadata can be consumed by other .NET Core applications. And, the option enables the component to consume types and data in the metadata of other .NET Core components.
29
+
30
+
-**`nostdlib`**
31
+
32
+
Instructs the compiler to ignore the default *`\clr`* directory. The compiler produces errors if you include multiple versions of a DLL, such as System.dll. This option lets you specify the specific framework to use during compilation.
25
33
26
34
-**`pure`**
27
35
@@ -43,15 +51,11 @@ One or more of the following comma-separated arguments.
43
51
44
52
-**`initialAppDomain`**
45
53
46
-
Enables a C++/CLI application to run on version 1 of the CLR. An application that's compiled by using **`initialAppDomain`** shouldn't be used by an application that uses ASP.NET because it's not supported in version 1 of the CLR.
47
-
48
-
-**`nostdlib`**
49
-
50
-
Instructs the compiler to ignore the default *`\clr`* directory. The compiler produces errors if you include multiple versions of a DLL, such as System.dll. This option lets you specify the specific framework to use during compilation.
54
+
**`initialAppDomain` is obsolete**. Enables a C++/CLI application to run on version 1 of the CLR. An application that's compiled by using **`initialAppDomain`** shouldn't be used by an application that uses ASP.NET because it's not supported in version 1 of the CLR.
51
55
52
56
## Remarks
53
57
54
-
Managed code is code that can be inspected and managed by the CLR. Managed code can access managed objects. For more information, see [`/clr`Restrictions](clr-restrictions.md).
58
+
*Managed code* is code that can be inspected and managed by the CLR. Managed code can access managed objects. For more information, see [`/clr`Restrictions](clr-restrictions.md).
55
59
56
60
For information about how to develop applications that define and consume managed types in C++, see [Component Extensions for Runtime Platforms](../../extensions/component-extensions-for-runtime-platforms.md).
57
61
@@ -95,10 +99,13 @@ Use ildasm.exe to view metadata.
95
99
96
100
1. Set the **Configuration** dropdown to **All configurations**, and set the **Platform** dropdown to **All Platforms**.
97
101
98
-
1. Select the **Configuration Properties** > **Advanced** page.
102
+
1. Select the **Configuration Properties** > **C/C++** > **General** page.
99
103
100
104
1. Modify the **Common Language Runtime Support** property. Choose **OK** to save your changes.
101
105
106
+
> [!NOTE]
107
+
> In the Visual Studio IDE, the **`/clr`** compiler option can be individually set on the **Configuration Properties** > **C/C++** > **General** page of the Property Pages dialog. However, we recommend you use a CLR template to create your project. It sets all of the properties required for successful creation of a CLR component. Another way to set these properties is to use the **Common Language Runtime Support** property on the **Configuration Properties** > **Advanced** page of the Property Pages dialog. This property sets all the other CLR-related tool options at once.
108
+
102
109
### To set this compiler option programmatically
103
110
104
111
- See <xref:Microsoft.VisualStudio.VCProjectEngine.VCCLCompilerTool.CompileAsManaged>.
For each combination of project configuration and target platform in your project, you can specify a custom step to be performed when the project is built.
11
+
For each project configuration and target platform combination in your project, you can specify a custom step to execute when the project is built.
11
12
12
13
For the Linux version of this page, see [Custom Build Step Properties (Linux C++)](../../linux/prop-pages/custom-build-step-linux.md).
13
14
14
-
## UIElement List
15
+
## General page
15
16
16
17
-**Command Line**
17
18
@@ -31,17 +32,17 @@ For the Linux version of this page, see [Custom Build Step Properties (Linux C++
31
32
32
33
-**Execute After and Execute Before**
33
34
34
-
These options define when the custom build step is run in the build process, relative to the listed targets. The most commonly listed targets are BuildGenerateSources, BuildCompile, and BuildLink, because they represent the major steps in the build process. Other often-listed targets are Midl, CLCompile, and Link.
35
+
These options define when the custom build step is run in the build process, relative to the listed targets. The most commonly listed targets are `BuildGenerateSources`, `BuildCompile`, and `BuildLink`, because they represent the major steps in the build process. Other often-listed targets are `Midl`, `CLCompile`, and `Link`.
35
36
36
37
-**Treat Output As Content**
37
38
38
-
This option is only meaningful for Universal Windows Platform or Windows Phone apps, which include all content files in the .appx package.
39
+
This option is only meaningful for Universal Windows Platform or Windows Phone apps, which include all content files in the *`.appx`* package.
39
40
40
41
### To specify a custom build step
41
42
42
-
1. On the menu bar, choose **Project**,**Properties**. For more information, see [Set C++ compiler and build properties in Visual Studio](../working-with-project-properties.md).
43
+
1. On the menu bar, choose **Project** >**Properties**. For more information, see [Set C++ compiler and build properties in Visual Studio](../working-with-project-properties.md).
43
44
44
-
1. In the **Property Pages** dialog box, navigate to the **Configuration Properties**, **Custom Build Step**,**General** page.
45
+
1. In the **Property Pages** dialog box, navigate to the **Configuration Properties** > **Custom Build Step** >**General** page.
0 commit comments