diff --git a/CppCliInterop/CppCliInterop.vcxproj b/CppCliInterop/CppCliInterop.vcxproj index 8841fee..95ef59c 100644 --- a/CppCliInterop/CppCliInterop.vcxproj +++ b/CppCliInterop/CppCliInterop.vcxproj @@ -21,7 +21,7 @@ 16.0 {D72A5A0F-4FB0-4E11-ADE7-40CC377D06E9} - netcoreapp3.1 + net6.0-windows ManagedCProj CppCliInterop 10.0 @@ -30,28 +30,28 @@ DynamicLibrary true - v142 + v143 NetCore Unicode DynamicLibrary false - v142 + v143 NetCore Unicode DynamicLibrary true - v142 + v143 NetCore Unicode DynamicLibrary false - v142 + v143 NetCore Unicode @@ -143,16 +143,16 @@ - - - {14da10c8-ac12-4456-aa41-740a5699ed97} - - true + + + {14da10c8-ac12-4456-aa41-740a5699ed97} + + diff --git a/ManagedLibrary/ManagedLibrary.csproj b/ManagedLibrary/ManagedLibrary.csproj index 46eef71..27f74cd 100644 --- a/ManagedLibrary/ManagedLibrary.csproj +++ b/ManagedLibrary/ManagedLibrary.csproj @@ -2,7 +2,7 @@ Library - net47;netcoreapp3.1 + net6.0-windows true diff --git a/NativeApp/NativeApp.vcxproj b/NativeApp/NativeApp.vcxproj index 95777f2..13a9dcd 100644 --- a/NativeApp/NativeApp.vcxproj +++ b/NativeApp/NativeApp.vcxproj @@ -29,26 +29,26 @@ Application true - v142 + v143 Unicode Application false - v142 + v143 true Unicode Application true - v142 + v143 Unicode Application false - v142 + v143 true Unicode diff --git a/ReadMe.md b/ReadMe.md index 5fca30b..8c0e2fd 100644 --- a/ReadMe.md +++ b/ReadMe.md @@ -1,3 +1,9 @@ +# Porting this project to .NET 5/6 +You can check out the [dotnet branch](https://github.com/Gnomorian/CppCliMigrationSample/tree/dotnet) for a buildable example. +- Use Visual Studio 2022 and migrage the projects to v143 +- change the targetframework or targetframeworks in the ManagedLibrary to `net6.0-windows`. This is much easier in 2022 as targetframeworks is now listed in the properties rather than having to go hunting through the .csproj file. +- Change the CppCliInterop library's TargetFramework to net6.0-windows either in the vcxproj file or in the properties project under Advanced. + # Porting a C++/CLI Project to .NET Core One of the new features of Visual Studio 2019 version 16.4 and .NET Core 3.1 is the ability to build C++/CLI projects targeting .NET Core. This can be done either directly with *cl.exe* and *link.exe* (using the new `/clr:netcore` option) or via MSBuild (using `NetCore`). In this post, I'll walk through the steps necessary to migrate a simple C++/CLI interop project to .NET Core. More details can be found in [.NET Core documentation](https://docs.microsoft.com/dotnet/core/porting/cpp-cli). @@ -78,4 +84,4 @@ Hopefully this sample shows how to take advantage of the new functionality in Vi * [C++/CLI .NET Core migration docs](https://docs.microsoft.com/dotnet/core/porting/cpp-cli) * [The sample used in this post](https://github.com/mjrousos/CppCliMigrationSample) (the original sample is in the master branch and the .NET Core updates are in the netcore branch) -* [.NET Portability Analyzer](https://github.com/Microsoft/dotnet-apiport) \ No newline at end of file +* [.NET Portability Analyzer](https://github.com/Microsoft/dotnet-apiport)