Hi, I'm afraid it's not so simple.
.NET 5 is not .NET Framework. It's a combination of .NET Core and .NET Standard.
The last version of .NET Framework is 4.8. Microsoft will not release any future versions of .NET Framework.
https://devblogs.microsoft.com/dotnet/net-core-is-the-future-of-net/
I have build a simplest plugin DLL with .NET 5.0 Preview 3 referencing "acoremgd.dll", "acmgd.dll" and "acdbmgd.dll" from AutoCAD 2021.
I could not load this DLL in AutoCAD using "NETLOAD" command as I got the following error:
Cannot load assembly. Error details: System.IO.FileNotFoundException: Could not load file or assembly 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
File name: 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
at System.ModuleHandle.ResolveType(RuntimeModule module, Int32 typeToken, IntPtr* typeInstArgs, Int32 typeInstCount, IntPtr* methodInstArgs, Int32 methodInstCount, ObjectHandleOnStack type)
at System.ModuleHandle.ResolveTypeHandleInternal(RuntimeModule module, Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext)
at System.Reflection.RuntimeModule.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
at System.Reflection.CustomAttribute.FilterCustomAttributeRecord(CustomAttributeRecord caRecord, MetadataImport scope, Assembly& lastAptcaOkAssembly, RuntimeModule decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, Object[] attributes, IList derivedAttributes, RuntimeType& attributeType, IRuntimeMethodInfo& ctor, Boolean& ctorHasParameters, Boolean& isVarArg)
at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes, Boolean isDecoratedTargetSecurityTransparent)
at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeAssembly assembly, RuntimeType caType)
at Autodesk.AutoCAD.ApplicationServices.AutoCADApplicationHolder.Initialize(Assembly assembly)
at Autodesk.AutoCAD.ApplicationServices.ExtensionLoader.ProcessAssembly(Assembly assembly)
WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
It looks like the reflection which AutoCAD uses to discover methods with CommandMethod attribute does not work with .NET 5 libaries.
I got this error regardless of whether I published the DLL as a Self-Contained or Framework-Dependent deployment, so the error does not mean that my DLL couldn't find some reference. The error is clearly coming from AutoCAD codebase as can be seen in the call stack.
I would also like to point out that I could successfully run .NET 5 applications outside of AutoCAD on my test machine, just to avoid any comments of type that I don't know how to deploy .NET apps.
So, in conclusion, I don't think that current versions of AutoCAD support .NET 5.
We may need to wait for Autodesk to officially support it.
Otherwise they will be stuck on .NET Framework 4.8.
It's a bit strange that there is not a lot more activity about this or that Autodesk does not put out an official statement so that developers can prepare.