.NET programming with C++/CLI

By default, CLR projects created with Visual Studio 2015 target .NET Framework 4.5.2. You can target .NET Framework 4.6 when you create a new project. In the New Project dialog, change the target framework in the dropdown at the top middle of the dialog. To change the target framework for an existing project, close the project, edit the project file (.vcxproj), and change the value of the Target Framework Version to 4.6. The changes take effect the next time you open the project.

In Visual Studio 2017, the default target .NET Framework is 4.6.1. The Framework version selector is at the bottom of the New Project dialog.

Install C++/CLI support in Visual Studio 2017

C++/CLI itself isn't installed by default when you install a Visual Studio C++ workload. To install the component after Visual Studio is installed, open the Visual Studio Installer by selecting the Windows Start menu and searching for visual studio installer. Choose the Modify button next to your installed version of Visual Studio. Select the Individual components tab. Scroll down to the Compilers, build tools, and runtimes section, and select C++/CLI support. Select Modify to download the necessary files and update Visual Studio.

In Visual Studio 2019, the default target framework for .NET Core projects is 5.0. For .NET Frameworks projects, the default is 4.7.2. The .NET Framework version selector is on the Configure your new project page of the Create a new project dialog.

Install C++/CLI support in Visual Studio 2019

C++/CLI itself isn't installed by default when you install a Visual Studio C++ workload. To install the component after Visual Studio is installed, open the Visual Studio Installer by selecting the Windows Start menu and searching for visual studio installer. Choose the Modify button next to your installed version of Visual Studio. Select the Individual components tab. Scroll down to the Compilers, build tools, and runtimes section, and select C++/CLI support for v142 build tools (Latest). Select Modify to download the necessary files and update Visual Studio.

In Visual Studio 2022, the default target framework for .NET Core projects is 6.0. For .NET Frameworks projects, the default is 4.7.2. The .NET Framework version selector is on the Configure your new project page of the Create a new project dialog.

Install C++/CLI support in Visual Studio 2022

C++/CLI itself isn't installed by default when you install a Visual Studio C++ workload. To install the component after Visual Studio is installed, open the Visual Studio Installer by selecting the Windows Start menu and searching for visual studio installer. Choose the Modify button next to your installed version of Visual Studio. Select the Individual components tab. Scroll down to the Compilers, build tools, and runtimes section, and select C++/CLI support for v143 build tools (Latest). Select Modify to download the necessary files and update Visual Studio.

In this section

C++/CLI tasks

Native and .NET interoperability

Pure and verifiable code (C++/CLI)

Regular expressions (C++/CLI)

File handling and I/O (C++/CLI)

Graphics operations (C++/CLI)

Windows operations (C++/CLI)

Data access using ADO.NET (C++/CLI)

Interoperability with other .NET languages (C++/CLI)

Serialization (C++/CLI)

Managed types (C++/CLI)

Reflection (C++/CLI)

Strong Name assemblies (assembly signing) (C++/CLI)

Debug class (C++/CLI)

STL/CLR library reference

C++ support library

Exceptions in C++/CLI

Boxing (C++/CLI)

See also

Native and .NET interoperability