Hi Guys
I thought i would share my solution to upgrade a Class Library Project to .Net 8.0 for Plugins for Autocad 2025. i see allot of people being confused regarding this whole topic especially when it comes down to using Microsoft.Data.SqlClient.
Create a New Class Library (.NET FrameWork).
Create your Project as Usual
Right Click On your Solution in the Solutions Explorer and select "Upgrade"
Because this is a new Project i am going to to an In-Place Project Upgrade:
Choose .NET 8.0 (Make sure that you have installed the .net 8.0 SDK
link: https://dotnet.microsoft.com/en-us/download/dotnet/8.0
Once the Project is Upgraded its important that we do a few necessary steps to ensure everything is set up correct.
In my case i want to use SQL Client, Winforms.
Open The Properties op your Solution, and set the following options.
Target OS: Windows
Platform Target: x64
Nullable: Enable (Preference)
Set the Rest of Your properties as required.
Install Microsoft.Data.SqlClient (If Required). in the nuget package manager
Now Add you Autocad .dll reference files. Just a small note that this can also be added via the nuget package manger when searching for Autocad:
This is What my Project file looks Like now after adding my .dll files:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0-windows</TargetFramework>
<OutputType>Library</OutputType>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<AssemblyTitle>Test_Class</AssemblyTitle>
<Company>SCCM-SUN-ZA</Company>
<Product>Test_Class</Product>
<Copyright>Copyright © SCCM-SUN-ZA 2024</Copyright>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
<FileVersion>1.0.0.0</FileVersion>
<PlatformTarget>x64</PlatformTarget>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Azure.Identity" Version="1.12.0" />
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="Microsoft.Data.SqlClient" Version="5.2.0" />
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
</ItemGroup>
<ItemGroup>
<Reference Include="accoremgd">
<HintPath>..\..\..\..\..\Program Files\Autodesk\AutoCAD 2025\accoremgd.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Acdbmgd">
<HintPath>..\..\..\..\..\Program Files\Autodesk\AutoCAD 2025\acdbmgd.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Acmgd">
<HintPath>..\..\..\..\..\Program Files\Autodesk\AutoCAD 2025\acmgd.dll</HintPath>
<Private>False</Private>
</Reference>
</ItemGroup>
</Project>
Now Lets Continue....
There are a few manual steps to be added to ensure that you will be able to use winforms if needed and also make sure that you will be able to use the mySql Client.
This is my Project file after adding a few manual lines:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0-windows</TargetFramework>
<OutputType>Library</OutputType>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<AssemblyTitle>Test_Class</AssemblyTitle>
<Company>SCCM-SUN-ZA</Company>
<Product>Test1</Product>
<Copyright>Copyright © SCCM-SUN-ZA 2024</Copyright>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
<FileVersion>1.0.0.0</FileVersion>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<PlatformTarget>x64</PlatformTarget>
<Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Azure.Identity" Version="1.12.0" />
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="Microsoft.Data.SqlClient" Version="5.2.0" />
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
</ItemGroup>
<ItemGroup>
<Reference Include="accoremgd">
<HintPath>..\..\..\..\..\Program Files\Autodesk\AutoCAD 2025\accoremgd.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Acdbmgd">
<HintPath>..\..\..\..\..\Program Files\Autodesk\AutoCAD 2025\acdbmgd.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Acmgd">
<HintPath>..\..\..\..\..\Program Files\Autodesk\AutoCAD 2025\acmgd.dll</HintPath>
<Private>False</Private>
</Reference>
</ItemGroup>
</Project>
YOu will be able to spot the added lines:
<UseWindowsForms>true</UseWindowsForms>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
the "<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>" is only needed to use mysql otherwise the mysql.dll files will not be generated when building your plugin.
@Domzinator a écrit :
[...]
Create a New Class Library (.NET FrameWork).
Create your Project as Usual[...]
Right Click On your Solution in the Solutions Explorer and select "Upgrade"
[...]
Why not simply create a New Class Library (.NET or .NET Standard instead of .NET Framework)?
Or use some AutoCAD R25 Project Template?
And then, edit the project SDK (.csproj file) to suit your needs.
There are many ways to do this, i thought i would just share some info that might be helpfull. but you are correct
Can't find what you're looking for? Ask the community or share your knowledge.