How to migrate an AutoCAD based application to .NET Core 8.0 [Part II]

This is a two-part blog series, where I describe the porting of an AutoCAD based application from .NET Framework to the new .NET Core 8.0.

In the first part, I have shown the migration of a managed C++/CLI solution from .NET Framework 4.x to .NET Core 8.0.

In this part, I will describe the migration from .NET Framework 4.x to .NET Core 8.0 for fully managed applications, usually realized with C# or VB dotnet. Unfortunately, the migration for managed .NET applications is a little more complicated when we want to have every project setting in .NET Core exactly as it has been with the legacy .NET Framework.

Part 2: Migrate your .NET AutoCAD based application from .NET Framework 4.x to .NET Core 8.0

This migration is similar to the workflow I described in the first part of this article, with some notable exception. For the migration to work, it is advisable to have at least Visual Studio 2022 Version 17.8 installed (I did not test this with older versions of VS).

I am demonstrating the migration for a .NET application with a solution called AuSt10Mgd from our AutoSTAGE application. (Disclaimer: I am the lead developer for AutoSTAGE).

I am describing one way and to my knowledge the best practice of doing the migration. If you have another way of doing the migration, let me know with a comment below the post.

The demonstration solution is targeting the AutoCAD version 2020 to 2024, including respective builds for AutoCAD OEM.

101_AuSt10Mgd_Solution_Targets

To make this buildable for AutoCAD 2025, we need to add a new configuration target, which we will call ACAD2025 in this demonstration.

It is advisable to unload the solution before editing the solution and/or project files.

[1] Edit project structure

Before we can add the new configuration target, we need to set the project structure to be able to deal with two .csproj files.

These are the files that are contained in the Visual Studio Solution:

102_AuSt10Mgd_Explorer

The marked files govern the behaviour of the Visual Studio solution, which can contain multiple projects.

There is the *.csproj file that describes the actual project. The solution *.sln file wraps one or multiple project *.csproj files. The *.csproj.user file is an accessory file that we can safely ignore for the migration.

Create a new folder called (project-name)_net4 and move all project specific files and folders into the new subfolder. Do not move any git files and the .sln file into the new subfolder!

The solution root folder after the movement of the files:

103_AuSt10Mgd_Explorer_post_move

And the content of the AuSt10Mgd_net4 project folder:

104_AuSt10Mgd_net4_subfolder

First, we need to open the *.sln file from the solution root folder in VS Code and add the configurations for AutoCAD 2025:

Open the subfolder and rename the *.vcxproj files to *_net4.vcxproj.

105_Renamed_csproj_files

Then open the *_net4.vcxproj file (ignore the .vcxproj.user file) and copy all sections from ACAD2024 and rename the copied sections to ACAD2025. The screenshot shows an abbreviated version, the file is quite long.

Since we have changed the path and name of the *.csproj file, we need to mirror that change in the solution file:

Save the *.sln and *.csproj files and reload the solution in Visual Studio.

[2] Fix missing configuration

Sometimes, when manually editing the *.sln and *.vcxproj files, not all configuration targets show up in the project configuration drop down. Here we would expect to see ACAD2025 as well.

108_Missing_Configuration

Open the configuration manager to fix this with the addition of a new configuration called ACAD2025.

Now the project configuration looks like expected:

192_Fixed_Configuration

Now check if you can build this for ACAD2024 and .NET Framework 4.x.

Die Neuerstellung wurde um 12:26 gestartet...
1>------ Neues Erstellen gestartet: Projekt: AuSt10Mgd_net4, Konfiguration: ACAD2024 x64 ------
1>  ***
1>  *** Build to D:\REL\RELEASE\ACAD2024\AuSt10Mgd.dll
1>  AuSt10Mgd_net4 -> D:\REL\RELEASE\ACAD2024\AuSt10Mgd.dll
1>  ***
========== Alle neu erstellen: 1 erfolgreich, 0 fehlgeschlagen, 0 ĂĽbersprungen ==========
========== Neu erstellen abgeschlossen um 12:26 und dauerte 23,607 Sekunden ==========

(The echo with the *** are pre- and post-build messages used for our build automation. This will not occur normally while building).

This builds fine for ACAD2024.

[3] Create new .NET Core 8.0 project with the .NET Upgrade Assistant

Trying to build the new configuration for AutoCAD 2025 will not work, because we are still stuck with .NET Framework 4.8, which has been used by AutoCAD 2024.

With .NET Core, the format of the *.vsproj file has been changed to the new SDK-style project format.

This is different than the format that has been previously used with the .NET Framework.

Because of this divergence, we must introduce another *.csproj file to be able to target ACAD2025. The new *.csproj file is used specifically for .NET 8.0. Whenever there is the mention of a *.csproj file in the following article, the new format for .NET 8.0 is meant (we are basically done with .NET Framework 4.x).

Fortunately, Microsoft has released an .NET Upgrade Assistant which is a nice help to generate the new SDK-Style project file for us. The Assistant needs to be installed prior to be able proceed with the following workflow.

When the .NET Upgrade Assistant has been installed, the Assistant can be started by right clicking on the project name in Visual Studio.

111_Upgrade_csproj_with_assistant

Now we have two options:

  • Upgrade project to newer .NET version
    This will create a new SDK-style project file. We will use this option for the migration.

  • Upgrade project features
    This will just upgrade the existing *.csproj file to the new SDK-style project type. This is not the ideal route for the migration, so we will ignore this.

When selecting the first option, we need to select the preferred upgrade type. We need to have a second csproj-file, so we choose Side-by-side project upgrade.

113_Upgrade_assistant_Ugrade_Type

With this, we can only create a new project as upgrade target.

114_Upgrade_assistant_Ugrade_Target

We will have to choose a name for the new project. To be future oriented, we keep the original project name for .NET Core.

115_Upgrade_assistant_Ugrade_Name

Now choose your preferred target framework. Naturally, we choose .NET 8.0 when we want to target AutoCAD 2025.

116_Upgrade_assistant_Ugrade_Framework

Finally, we can choose the components for the upgrade.

Here, we must be very careful!

If we select all files, we make copies of the existing files located in the AuSt10Mgd_net4 folder. When doing this, we mirror our codebase, which will surely introduce headaches in the future when trying to maintain the code. If any changes are needed, we would have to do it in two separate folders. This could balloon to a veritable maintainer’s nightmare. So, we don’t want to go down this path.

Instead, we just select the bare minimum we need to have, which are the dependencies.

All other files will be linked later into this new .NET 8.0 project. We ensure with the linking that we work with only one codebase for .NET Framework and .NET Core, which reduces the maintainers nightmare by a wide margin.

If you work with Resources (especially pictures), I recommend to also select the Properties and Resources folder as well. This ensures that you can access the resources directly in this project (with the disadvantage that you would have to maintain two different resource folders for .NET 4.x and .NET 8.0).

This sample project does not contain any resource, we just select the dependencies and start the upgrade with Upgrade selection.

117_Upgrade_assistant_Ugrade_Selection

Visual Studio will now create the new SDK-Style *.csproj file for .NET 8.0 for us. We have selected the dependencies, which will be added to the project, but which need to be tweaked later to be of any use to us.

Here we see the solution with the newly created project named AuSt10Mgd for .NET 8.0.

121_Solution_with_two_projects

And the view of the solution in the file system:

122_Solution_with_two_projects_in_Explorer

The *.sln-file has been changed as well by the Upgrade Assistant:

[4] Tweak the resulting .NET Core 8.0 project

The .NET Upgrade Assistant did much good, but we need to tweak the solution some more. Open the solution with Visual Studio and then the Configuration manager.

124_Upgrade_assistant_generic_configurations

Set the project configuration at the top left to ACAD2025 and add a new ACAD2025 configuration for the first .NET 8.0 project. Repeat this for ACAD2025_OEM, if necessary.

The upgrade assistant has introduced the generic Debug and Release configurations in the .NET 8.0 project. If you don’t need this, you can remove the entries in the *.sln and .NET 8.0 *.csproj file.

Don’t forget to delete this in both files! Otherwise, you get dangling configuration links, and Visual Studio may become unstable or unpredictable when dealing with the configurations.

Remove the generic release and debug entries in the *.sln-file. You have to do it for both project GUIDs.

In the .NET 8.0 *.csproj-file, you just have to change the node Configurations from

<Configurations>Debug;Release;ACAD2025;ACAD2025_OEM</Configurations>

to

<Configurations>ACAD2025;ACAD2025_OEM</Configurations>

Reload the solution in Visual Studio, the generic configurations are gone:

126_Configurtions_after_removal

See Appendix B further down for a description how to add a debug configuration to target specifically AutoCAD 2025 for debugging.

When we open .NET 8 project in the Visual Studio project explorer, we see some errors and warnings we need to address.

[5] Fix ghost folders and files

In the project, we see a ghost folder called Resources, that is not existing in the file system. We can delete this safely to get rid of the folder.

131_Delete_ghost_resources

[6] Fix unresolved assembly references

Additionally, some assembly references could not be resolved properly. We build this project targeting different AutoCAD versions with differing Framework requirements. Therefore, we need to have reference assemblies that are enabled for the specific Framework requirements.

We get the assemblies AcMgd, AcDbMgd and AcCoreMgd from the actual AutoCAD SDK in the file system. The reference assemblies are set in the *.csproj file in the ItemGroup section of the respective configuration:

<ItemGroup Condition="'$(Configuration)|$(Platform)' == 'ACAD2025|x64'">
    <Reference Include="AcCoreMgd">
      <SpecificVersion>False</SpecificVersion>
      <HintPath>$(ARX2025)\inc\AcCoreMgd.dll</HintPath>
      <Private>False</Private>
    </Reference>
    <Reference Include="AcDbMgd">
      <SpecificVersion>False</SpecificVersion>
      <HintPath>$(ARX2025)\inc\AcDbMgd.dll</HintPath>
      <Private>False</Private>
    </Reference>
    <Reference Include="AcMgd">
      <SpecificVersion>False</SpecificVersion>
      <HintPath>$(ARX2025)\inc\AcMgd.dll</HintPath>
      <Private>False</Private>
    </Reference>
  </ItemGroup>

The variable $(ARX2025) gets resolved in this example to the actual save path in the filesystem. This is an excerpt of the registered system path variables:

(You can get a list of the system variables with opening a Windows Command Prompt and the SET command.)

With the HintPath node, we tell the compiler the actual path to the proper assembly we want to reference.

The unresolved assemblies are included as simple references in the *.csproj file:

  <ItemGroup>
    <Reference Include="AuStWrapper" />
    <Reference Include="AuStMgd" />
    <Reference Include="AuStCoreMgd" />
    <Reference Include="AuStUiMgd" />
  </ItemGroup>

We get the warning because the compiler has no knowledge of the proper path.
To change this, we have to elaborate the references with the proper HintPath.

You can do the referencing in two ways:

  • a) If the to be referenced assembly is located in the output build path, just use the $(OutputPath) variable with the <HintPath> node.

  • b) If the to be referenced assembly is located in any other file path, you have to use a relative or absolute path in the <HintPath> node.

[6a] Example for reference assembly in output build path

This ItemGroup has no fixed configuration condition. We simply asume that the referenced assemblies in the output build path target the same .NET framework.

  <ItemGroup>
    <Reference Include="AuStWrapper">
      <SpecificVersion>False</SpecificVersion>
      <HintPath>$(OutputPath)\AuStWrapper.dll</HintPath>
      <Private>False</Private>
    </Reference>    
      <Reference Include="AuStMgd">
        <SpecificVersion>False</SpecificVersion>
        <HintPath>$(OutputPath)\AuStMgd.dll</HintPath>
        <Private>False</Private>
      </Reference>   
    <Reference Include="AuStCoreMgd">
      <SpecificVersion>False</SpecificVersion>
      <HintPath>$(OutputPath)\AuStCoreMgd.dll</HintPath>
      <Private>False</Private>
    </Reference>   
    <Reference Include="AuStUiMgd">
      <SpecificVersion>False</SpecificVersion>
      <HintPath>$(OutputPath)\AuStUiMgd.dll</HintPath>
      <Private>False</Private>
    </Reference>          
  </ItemGroup>

[6b] Example for reference assembly in any other path

When referencing assemblies from any other path, you should do this withhin the proper configuration condition to make sure that the assembly .NET framework requirements check out.

<ItemGroup Condition="'$(Configuration)|$(Platform)' == 'ACAD2025|x64'">
    <Reference Include="AuStWrapper">
      <SpecificVersion>False</SpecificVersion>
      <HintPath>$(REL_ACAD2025)\AuStWrapper.dll</HintPath>
      <Private>False</Private>
    </Reference>    
    <Reference Include="AuStMgd">
      <SpecificVersion>False</SpecificVersion>
      <HintPath>$(REL_ACAD2025)\AuStMgd.dll</HintPath>
      <Private>False</Private>
    </Reference>     
    <Reference Include="AuStCoreMgd">
      <SpecificVersion>False</SpecificVersion>
      <HintPath>$(REL_ACAD2025)\AuStCoreMgd.dll</HintPath>
      <Private>False</Private>
    </Reference>   
    <Reference Include="AuStUiMgd">
      <SpecificVersion>False</SpecificVersion>
      <HintPath>$(REL_ACAD2025)\AuStUiMgd.dll</HintPath>
      <Private>False</Private>
    </Reference>     
    <Reference Include="AcCoreMgd">
      <SpecificVersion>False</SpecificVersion>
      <HintPath>$(ARX2025)\inc\AcCoreMgd.dll</HintPath>
      <Private>False</Private>
    </Reference>
    <Reference Include="AcDbMgd">
      <SpecificVersion>False</SpecificVersion>
      <HintPath>$(ARX2025)\inc\AcDbMgd.dll</HintPath>
      <Private>False</Private>
    </Reference>
    <Reference Include="AcMgd">
      <SpecificVersion>False</SpecificVersion>
      <HintPath>$(ARX2025)\inc\AcMgd.dll</HintPath>
      <Private>False</Private>
    </Reference>         
  </ItemGroup>

Here we use another system variable that resolves to the build path of the respective solution:

142_AutoSTAGE_Release

Don’t forget to add the references for all configurations where the assemblies are needed.

After saving the *.csproj file, the references are updates in the Visual Studio project explorer:

144_Updates_References

Now set the configuration to ACAD2025 and try to build the project.

Die Neuerstellung wurde um 14:56 gestartet...
1>------ Neues Erstellen gestartet: Projekt: AuSt10Mgd, Konfiguration: ACAD2025 x64 ------
"D:\DEV\_AuStMgd\AuSt10Mgd\AuSt10Mgd\AuSt10Mgd.csproj" wiederhergestellt (in 0,7 ms.).
1>***
1>*** Build to D:\REL\RELEASE\ACAD2025\AuSt10Mgd.dll
1>AuSt10Mgd -> D:\REL\RELEASE\ACAD2025\net8.0-windows\AuSt10Mgd.dll
1>***
========== Alle neu erstellen: 1 erfolgreich, 0 fehlgeschlagen, 0 ĂĽbersprungen ==========
========== Neu erstellen abgeschlossen um 14:56 und dauerte 00,444 Sekunden ==========

This builds fine for ACAD2025.

[7] Fix output build path

But we notice that the build output path is in a subfolder called net8.0-windows. We may not want to build into this subfolder, so we can add

<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>

in the first PropertyGroup of the *.csproj file (near where the Configurations node is located).

When we build this again, the output path resolves to the desired path.

Die Neuerstellung wurde um 15:00 gestartet...
1>------ Neues Erstellen gestartet: Projekt: AuSt10Mgd, Konfiguration: ACAD2025 x64 ------
"D:\DEV\_AuStMgd\AuSt10Mgd\AuSt10Mgd\AuSt10Mgd.csproj" wiederhergestellt (in 0,7 ms.).
1>***
1>*** Build to D:\REL\RELEASE\ACAD2025\AuSt10Mgd.dll
1>AuSt10Mgd -> D:\REL\RELEASE\ACAD2025\AuSt10Mgd.dll
1>***
========== Alle neu erstellen: 1 erfolgreich, 0 fehlgeschlagen, 0 ĂĽbersprungen ==========
========== Neu erstellen abgeschlossen um 15:00 und dauerte 00,579 Sekunden ==========

[8] Link payload codebase

Still missing is our payload codebase from the AuSt10Mgd_net4 project, which we want to link into this .NET 8.0 project.

Open the old .NET Framework AuSt10Mgd_net4.csproj file and copy all ItemsGroups that include the project files. Do not copy all files that are in the folders Properties and Resources, we don’t need these.

Paste the copied ItemGroups into the .NET 8.0 *.csproj file behund the last ItemGroup node:

When saving, we see the update in the Visual Studio project explorer. The added files can not be resolved, because the linking is still missing.

153_Missing_Links

[9] Use the csprojLink tool to automated the payload codebase linking

We could add the links manually. But with bigger projects with dozens or even hundreds of files, this is not very productive. I have written a small .NET 8.0 application called csprojLink that does the job for us. You can download the application here or make a fork from the csprojLink GitHub repository.

Download the application and extract the zip-file to a location of your choosing. Here, I have put it into the path C:\AuSt\.

Open the folder with Terminal (both PowerShell as well as CMD will work).

The application needs two parameters to work. The first parameter is the full path to the location of the *.csproj file. The second parameter is the link we need to apply

This are the parameters for this demonstration project:

  • D:\DEV_AuStMgd\AuSt10Mgd\AuSt10Mgd
  • …\AuSt10Mgd_net4

Both parameters should not be trailed by a backslash.

Call with Command Prompt

csprojLink "D:\DEV\_AuStMgd\AuSt10Mgd\AuSt10Mgd" "..\AuSt10Mgd_net4"

Call with PowerShell

.\csprojLink "D:\DEV\_AuStMgd\AuSt10Mgd\AuSt10Mgd" "..\AuSt10Mgd_net4"

If there are no spaces in the parameters, you can omit the quotation marks.

Call with Command Prompt
csprojLink D:\DEV\_AuStMgd\AuSt10Mgd\AuSt10Mgd ..\AuSt10Mgd_net4

Call with PowerShell
.\csprojLink D:\DEV\_AuStMgd\AuSt10Mgd\AuSt10Mgd ..\AuSt10Mgd_net4

Now csprojLink sets the links in the *.csproj-file.

When we look at the Visual project explorer, all files are linked properly.

156_Linked_files

[10] Silence compiler warnings

When building the project for ACAD2025, this builds ok, but expect to encounter some warnings from the compiler.

Die Neuerstellung wurde um 16:02 gestartet...
1>------ Neues Erstellen gestartet: Projekt: AuSt10Mgd, Konfiguration: ACAD2025 x64 ------
"D:\DEV\_AuStMgd\AuSt10Mgd\AuSt10Mgd\AuSt10Mgd.csproj" wiederhergestellt (in 0,7 ms.).
1>***
1>*** Build to D:\REL\RELEASE\ACAD2025\AuSt10Mgd.dll
1>D:\DEV\_AuStMgd\AuSt10Mgd\AuSt10Mgd_net4\AuSt10Cmd\AuStCommandUi.cs(69,32,69,135): warning CA1416: Diese Aufrufsite ist auf allen Plattformen erreichbar. "AuStUi.LoadEngine(List<Category>, bool, bool)" nur unterstützt für: Windows, 7.0 und höhere Versionen. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416)
1>D:\DEV\_AuStMgd\AuSt10Mgd\AuSt10Mgd_net4\AuSt10Cmd\AuStCommandUi.cs(46,33,46,73): warning CA1416: Diese Aufrufsite ist auf allen Plattformen erreichbar. "AuStRibbonContent.Get()" nur unterstützt für: Windows, 7.0 und höhere Versionen. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416)
1>D:\DEV\_AuStMgd\AuSt10Mgd\AuSt10Mgd_net4\AuSt10Cmd\AuStCommandUi.cs(66,37,66,141): warning CA1416: Diese Aufrufsite ist auf allen Plattformen erreichbar. "AuStUi.LoadEngine(List<Category>, bool, bool)" nur unterstützt für: Windows, 7.0 und höhere Versionen. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416)
1>D:\DEV\_AuStMgd\AuSt10Mgd\AuSt10Mgd_net4\AuSt10Cmd\AuStCommandUi.cs(51,35,51,69): warning CA1416: Diese Aufrufsite ist auf allen Plattformen erreichbar. "AuStUi.CloneWorkspaces(List<Category>, AuStLog, bool)" nur unterstützt für: Windows, 7.0 und höhere Versionen. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416)
1>D:\DEV\_AuStMgd\AuSt10Mgd\AuSt10Mgd_net4\AuSt10\AuStDwt.cs(30,21,30,52): warning CA1416: Diese Aufrufsite ist auf allen Plattformen erreichbar. "MessageBoxIcon.Question" nur unterstützt für: windows, 6.1 und höhere Versionen. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416)
1>D:\DEV\_AuStMgd\AuSt10Mgd\AuSt10Mgd_net4\AuSt10\AuStDwt.cs(26,45,30,53): warning CA1416: Diese Aufrufsite ist auf allen Plattformen erreichbar. "MessageBox.Show(string?, string?, MessageBoxButtons, MessageBoxIcon)" nur unterstützt für: windows, 6.1 und höhere Versionen. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416)
1>D:\DEV\_AuStMgd\AuSt10Mgd\AuSt10Mgd_net4\AuSt10\AuStDwt.cs(29,21,29,58): warning CA1416: Diese Aufrufsite ist auf allen Plattformen erreichbar. "MessageBoxButtons.YesNoCancel" nur unterstützt für: windows, 6.1 und höhere Versionen. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416)
1>D:\DEV\_AuStMgd\AuSt10Mgd\AuSt10Mgd_net4\AuSt10Cmd\AuStCommandUi.cs(72,39,72,133): warning CA1416: Diese Aufrufsite ist auf allen Plattformen erreichbar. "AuStUi.asUnloadEngine(List<Category>)" nur unterstützt für: Windows, 7.0 und höhere Versionen. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416)
1>D:\DEV\_AuStMgd\AuSt10Mgd\AuSt10Mgd_net4\AuStDesignCenter\AuSt10Dc.cs(219,17,219,48): warning CA1416: Diese Aufrufsite ist auf allen Plattformen erreichbar. "Control.SuspendLayout()" nur unterstützt für: windows, 6.1 und höhere Versionen. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416)
1>D:\DEV\_AuStMgd\AuSt10Mgd\AuSt10Mgd_net4\AuStDesignCenter\AuSt10Dc.cs(221,17,221,52): warning CA1416: Diese Aufrufsite ist auf allen Plattformen erreichbar. "ContainerControl.AutoScaleDimensions" nur unterstützt für: windows, 6.1 und höhere Versionen. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416)
1>D:\DEV\_AuStMgd\AuSt10Mgd\AuSt10Mgd_net4\AuStDesignCenter\AuSt10Dc.cs(224,17,224,47): warning CA1416: Diese Aufrufsite ist auf allen Plattformen erreichbar. "Control.ResumeLayout()" nur unterstützt für: windows, 6.1 und höhere Versionen. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416)
1>D:\DEV\_AuStMgd\AuSt10Mgd\AuSt10Mgd_net4\AuStDesignCenter\AuSt10Dc.cs(220,17,220,46): warning CA1416: Diese Aufrufsite ist auf allen Plattformen erreichbar. "ContainerControl.AutoScaleMode" nur unterstützt für: windows, 6.1 und höhere Versionen. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416)
1>D:\DEV\_AuStMgd\AuSt10Mgd\AuSt10Mgd_net4\AuStDesignCenter\AuSt10Dc.cs(220,49,220,87): warning CA1416: Diese Aufrufsite ist auf allen Plattformen erreichbar. "AutoScaleMode.Dpi" nur unterstützt für: windows, 6.1 und höhere Versionen. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416)
1>AuSt10Mgd -> D:\REL\RELEASE\ACAD2025\AuSt10Mgd.dll
1>***
1>Erstellen des Projekts AuSt10Mgd.csproj beendet.
========== Alle neu erstellen: 1 erfolgreich, 0 fehlgeschlagen, 0 ĂĽbersprungen ==========
========== Neu erstellen abgeschlossen um 16:02 und dauerte 00,480 Sekunden ==========

You can silence the warning with either adding
#pragma warning disable <warning-identifier>
to every file that triggers the warning.

Or you could set the project warning level to zero to omit all warnings.

Omitting the warnings produce a build without warnings:

Die Neuerstellung wurde um 16:07 gestartet...
1>------ Neues Erstellen gestartet: Projekt: AuSt10Mgd, Konfiguration: ACAD2025 x64 ------
"D:\DEV\_AuStMgd\AuSt10Mgd\AuSt10Mgd\AuSt10Mgd.csproj" wiederhergestellt (in 0,6 ms.).
1>***
1>*** Build to D:\REL\RELEASE\ACAD2025\AuSt10Mgd.dll
1>AuSt10Mgd -> D:\REL\RELEASE\ACAD2025\AuSt10Mgd.dll
1>***
========== Alle neu erstellen: 1 erfolgreich, 0 fehlgeschlagen, 0 ĂĽbersprungen ==========
========== Neu erstellen abgeschlossen um 16:07 und dauerte 01,024 Sekunden ==========

Be aware that you may miss some structural or coding problems when you are omitting all warnings!

Conclusion

Migrating a .NET based AutoCAD application from .NET Framework to .NET Core seems complicated at first, but if you do it a couple of times (if you have to do it that much) you get used to it.

The key is to link your codebase into the new .NET 8.0 project. With this, you can use the same codebase for two vastly different .NET Frameworks, which reduces maintenance effort by a great deal.

Appendix A: Reduce Configuration Manager warnings

In the last step, we have build the .NET 8.0 project for AutoCAD 2025. When selecting the .NET Framework 4.x project in the Visual Studio Project Explorer (AuSt10Mgd_net4) and selecting another configuration, you may get this Configuration Manager warning:

You can fix this with assigning existing configurations in the configuration manager.

From

to

This will remove the configuration manager warning when switching between the projects and configurations.

Appendix B: Add debug configuration for AutoCAD 2025

If you need to have a debug configuration for AutoCAD 2025, just copy the existing ACAD2025 configuration sections in the *.sln and *.csproj file and rename this to (for example) debugACAD2025.

It is advisable to unload the solution before editing the solution and/or project files.

In the csproj-file, change the Configurations node to

<Configurations>debugACAD2025;ACAD2025;ACAD2025_OEM</Configurations>

Don’t forget to copy and rename the sections

<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'ACAD2025|x64'">

and

<ItemGroup Condition="'$(Configuration)|$(Platform)' == 'ACAD2025|x64'">

accordingly to

<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'debugACAD2025|x64'">

and

<ItemGroup Condition="'$(Configuration)|$(Platform)' == 'debugACAD2025|x64'">

In the *.sln file, copy and rename this ACAD2025 entries:

When we open the solution, the new debugACAD2025 configuration can be used for build:

174_debugACAD2025

Die Neuerstellung wurde um 16:47 gestartet...
1>------ Neues Erstellen gestartet: Projekt: AuSt10Mgd, Konfiguration: debugACAD2025 x64 ------
"D:\DEV\_AuStMgd\AuSt10Mgd\AuSt10Mgd\AuSt10Mgd.csproj" wiederhergestellt (in 0,6 ms.).
1>***
1>*** Build to D:\REL\RELEASE\ACAD2025\AuSt10Mgd.dll
1>AuSt10Mgd -> D:\REL\RELEASE\ACAD2025\AuSt10Mgd.dll
1>***
========== Alle neu erstellen: 1 erfolgreich, 0 fehlgeschlagen, 0 ĂĽbersprungen ==========
========== Neu erstellen abgeschlossen um 16:47 und dauerte 00,311 Sekunden ==========

This builds fine for the debugACAD2025 configuration.

Appendix C: More resources

Autodesk Desktop API Update: .NET Core Migration

Organize your project to support both .NET Framework and .NET

Migrating from .NET 4.8 to .NET Core 8

4 Likes

Thanks Jens!
Shawn Golden
Microvellum

1 Like