Multi-targeting AutoCAD .NET Plugin for .NET 4.8 and .NET 8.0

<?xml encoding=”UTF-8″>By Madhukar Moogala

Recently, we received a query from an ADN partner on how to organize code to target multiple frameworks, such as
.NET 4.x and .NET 8.0.

Let’s take an ARX SDK sample project, EllipseJig.

EllipseJig is a simple .NET project that demonstrates the use of Jig APIs to create ellipses. The project is
available in the ObjectARX SDK samples

Here is the project structure

  
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<AssemblyName>JigSample</AssemblyName>
<OutputType>Library</OutputType>
<RootNamespace>JigSample</RootNamespace>
<TargetFramework>net8.0-windows</TargetFramework>
<GenerateAssemblyInfo>False</GenerateAssemblyInfo>
<Platforms>x64</Platforms>
<Configurations>ACAD2024;ACAD2025</Configurations>
<BaseOutputPath>bin</BaseOutputPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)' == 'ACAD2025'">
<TargetFramework>net8.0-windows</TargetFramework>
<!-- uncomment to use Forms or WPF-->
<!--<UseWindowsForms>true</UseWindowsForms>
<UseWPF>true</UseWPF>-->
<AssemblySearchPaths>D:ArxSdksArx2025inc;$(AssemblySearchPaths)</AssemblySearchPaths>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)' == 'ACAD2024'">
<TargetFramework>net48</TargetFramework>
<AssemblySearchPaths>D:ArxSdksArx2024inc;$(AssemblySearchPaths)</AssemblySearchPaths>
</PropertyGroup>
<ItemGroup Condition="'$(Configuration)' == 'ACAD2025'">
<FrameworkReference Include="Microsoft.WindowsDesktop.App"/>
</ItemGroup>
<ItemGroup>
<Reference Include="AcDbMgd">
<Private>False</Private>
</Reference>
<Reference Include="acmgd">
<Private>False</Private>
</Reference>
<Reference Include="accoremgd">
<Private>False</Private>
</Reference>
</ItemGroup>
</Project>

Github Project : Ellipsejig

Note:

We encourage you to use Git branching to organize and maintain releases instead of organizing projects to target
multiple frameworks. This is the same approach we adopt with the AutoCAD source code, which has billions of lines of
code.

In the image below, our main branch is always the latest and newest state and content.

Github-ACAD-Flow

When it’s time to switch to a new release, we branch “main” into “release2025.” After that, “main” will become
“2026,” and so on.

So, if your main branch is currently supporting AutoCAD 2024, you would branch this off into “release2024” and then
change “main” to support AutoCAD 2025.

For example, please find the Github project : ManagedCircle

There are two branches:

  • master – which is the current release 2025,
  • another branch for AutoCAD 2024 (.NET F4x)

If I have to roll out a fix to AutoCAD 2024, I will simply switch to that branch and work on it.


Comments

2 responses to “Multi-targeting AutoCAD .NET Plugin for .NET 4.8 and .NET 8.0”

  1. How are you then dealing with needing to make code changes that effect both the “main” and the “release2024” branch? – For example, ongoing improvements where you want to support both Autocad 2024 and 2025 (and 2026)?

  2. To support both AutoCAD 2024 (.NET Framework 4.8) and newer versions like 2025+ (.NET 8), we use a Git branching strategy where main targets the latest development for AutoCAD 2025+ and modern .NET, while release2024 maintains compatibility with older versions. Shared improvements or bug fixes are developed in main and cherry-picked into release2024 as needed. Features using 2025+ APIs stay in main, keeping the codebase clean and forward-compatible while supporting legacy users. You can bundle the respective DLLs in version-specific folders under Contents and configure them using RuntimeRequirements in PackageContents.xml.

Leave a Reply to Madhukar MoogalaCancel reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading