ProGuide NET 8 Upgrade - Esri/arcgis-pro-sdk GitHub Wiki

Language:      C#
Subject:       Framework
Contributor:   ArcGIS Pro SDK Team <[email protected]>
Organization:  Esri, http://www.esri.com
Date:          10/06/2024
ArcGIS Pro:    3.4
Visual Studio: 2022

Overview

At release 3.3, ArcGIS Pro moved to .NET 8, Microsoft's latest version of .NET (formerly known as ".NET Core") with Long Term Support, LTS.

  1. This is not a breaking change.
  2. There are no changes to Pro APIs that require re-compilation
  3. Addins deployed on ArcGIS Pro 3.0 - 3.2 will run on 3.3 and newer 3.x releases without re-compilation.

Migrating from .NET 6 to .NET 8

For your ArcGIS Pro SDK .NET development going forward at 3.3+, to re-compile an addin that was built on 3.0 through 3.2 against Pro 3.3+, please consult the following migration procedure. It generally applies to all .NET 6 Pro SDK 3.0 to 3.2 development projects even though only "addins" are specifically mentioned.

Assuming that Pro 3.3+ has been installed...

  1. Upgrade your Visual Studio 2022 to version 17.8 or better (please refer to ArcGIS Pro SDK requirements). Ensure that you install .NET 8 as part of the Visual Studio update process.
  2. Change the target framework in your existing Visual Studio 2022 project to .NET 8

ChangingTargetFramework.png

  1. Open the Config.daml file and change the desktopVersion attribute on the AddInInfo tag to 3.3

desktopVersion.png

  1. If your project is using the Pro SDK "Esri.ArcGISPro.Extensions" NuGet package, upgrade it to version 3.3 or better. If you get a NU1202 Package Esri.ArcGISPro.Extensions30 3.3.0.52579 is not compatible with net6.0-windows7.0 error, it means you forgot to change your target framework to .NET 8 first.
  2. If you are using the Microsoft.Windows.Compatibility Nuget, update it to version 8.0.3 or better.
  3. If your project is using any other NuGet packages, ensure they are compatible with .NET 8.  Update as needed.
  4. If needed, run the "Fix Pro References" Pro SDK tool on your addin.
  5. Recompile.

Note: if you see errors similar to the following:

Error	CS1705
Assembly 'ArcGIS.Desktop.Framework' with identity 'ArcGIS.Desktop.Framework, Version=13.3.0.0, Culture=neutral, 
   PublicKeyToken=8fc3cc631e44ad86' uses 'System.Runtime, Version=8.0.0.0, Culture=neutral, 
   PublicKeyToken=b03f5f7f11d50a3a' which has a higher version than referenced assembly 'System.Runtime' 
   with identity 'System.Runtime, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'  
   "YourProjectName here" ...

You have forgotten to change the target framework of your project from .NET 6 to .NET 8. You may also see an error similar to the following, especially if you are re-compiling a CoreHost console .exe:

Error  NETSDK1083
The specified RuntimeIdentifier `win10-x64` is not recognized. See https://aka.ms/netsdk1083 for more information.

Open your .csproj and ensure the following lines show the correct content. Change as needed:

<TargetFramework>net8.0-windows</TargetFramework>
<!--RuntimeIdentifier>win10-x64</RuntimeIdentifier --><!-- old - note win"10"-x64 -->
<RuntimeIdentifier>win-x64</RuntimeIdentifier><!-- new - "win10-x64" was changed to "win-x64" -->

For more information consult NETSDK1083: The specified RuntimeIdentifier is not recognized

Migrating from .NET Framework to .NET 8

If you have an addin created using version 2.x and the .NET Framework, you will need to follow the procedure in the ProConcepts 3.0 Migration Guide to convert your project to Pro 3.x and .NET 6 first. Moving from 2.x to 3.x is a breaking change. With your add-in converted to a 3.x addin, follow the procedure above, as necessary, to re-compile on Pro 3.3+ and .NET 8.

Developing new Add-ins for 3.3 and newer releases

  1. Upgrade Visual Studio 2022 to 17.8 at a minimum and make sure that .NET 8 is included (please refer to ArcGIS Pro SDK requirements).
  2. Upgrade your Pro and Pro SDK versions to 3.3+
  3. Create a new ArcGIS Pro SDK project in Visual Studio 2022 using the appropriate Pro SDK project template.
⚠️ **GitHub.com Fallback** ⚠️