An unhandled exception of type 'System.BadImageFormatException' occurred in System.Windows.Forms.dll
Additional information: Could not load file or assembly 'Acdbmgd, Version=20.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format.
How to solve this error
You really need to post a bit more details/descriptions of what you are doing, such as:
Are you doing AutoCAD .NET API add-in (which is the main topic of this forum)? Or are you doing stand-alone EXE app and trying to use AutoCAD .NET API?
Which version of AutoCAD do you use for development and which version of AutoCAD that runs into this error (in debugging, or in real use)?
If I had to guess, I would guess that you are doing EXE WIN FORM app with setting references to AutoCAD's .NET API assemblies (acdbmgd.dll and others). If so, the error is expected: AutoCAD .NET API assemblies CANNOT be used in EXE app.
Norman Yuan
The AutoCAD .NET API cannot be used from a standalone EXE. They can only be used from a DLL that is loaded into AutoCAD using the NETLOAD command.
@Anonymous wrote:An unhandled exception of type 'System.BadImageFormatException' occurred in System.Windows.Forms.dll
Additional information: Could not load file or assembly 'Acdbmgd, Version=20.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format.
How to solve this error
@Anonymous wrote:
...
. how to insert autocad api ? How can i do it .
AutoCAD provides different sets of APIs. Using MS .NET framework/Visual Studio does not necessarily mean that you can use AutoCAD .NET API in EXE application.
If you have to control/automate AutoCAD from external EXE app, you use AutoCAD COM API.
I'd suggest to learn more about using AutoCAD, then programming AutoCAD before jumping right in Visual Studio to write code. After some due study, you might realize that using EXE app to automate AutoCAD may not be a good solution (in most cases, IMO).
Norman Yuan
Learn the basics of AutoCAD programming, including the various APIs (COM/ActiveX, .NET, etc) and become familiar with them to the degree that you can build a basic application.
You are trying to automate AutoCAD with little-to-no familiarity with its APIs, which is not going to work.
@Anonymous wrote:
yes this windows application i used autocad 2015 and Microsoft visual
Studio 2015. I used all dll required for run code env but they can not run
. how to insert autocad api ? How can i do it .
Can't find what you're looking for? Ask the community or share your knowledge.