I have created a program with VS2010 with a target .NET4.0.
It works fine in later versions of AutoCAD but I’m trying to get it to work under 2009 (Windows 7).
I get an error when trying to NETLOAD the .dll saying :
Cannot load assembly. Error details: System.BadImageFormatException:
This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.
I’ve tried adding v4.0 to acad.exe.config as suggested but then I get a fatal error when AutoCAD loads.
<!--All assemblies in AutoCAD are fully trusted so there's no point generating publisher evidence-->
On AutoCAD installation folder, look for acad.exe.config, enable supportedRuntime to allow Visual Studio 2010 debugging .NET framework 2.0 and 3.5 on AutoCAD. VS2010 by default uses .NET framework 4.0 to debug.
On Visual Studio 2010, go to Project Properties (right-click on project name and select Properties), then select Application tab, select Target framework 3.0 for AutoCAD 2009 or 3.5 for AutoCAD 2011.