Every .NET assembly reference including .NET Framework ones, AutoCAD ones, and any others has a Copy Local property. Whether to set it as True or False is not always clear and problems caused by wrongly setting the property may have very weird behaviour and are hard to track down.
In this article, we are going to discuss about it and suggest something good to follow.
In terms of .NET Framework assemblies, it is obvious that their Copy Local properties should be always False and the Add Reference UI of Visual Studio takes care it automatically for us. So we do not have to worry about the .NET Framework assemblies at all.
The reason is clear, the .NET Framework assemblies are supposed to be there in the Windows system rather than somewhere in your application folders. If the .NET Framework Runtime version that your programs require has already been there, we do not have to do anything about it; if not, either users need to download and install the right .NET Framework Runtime or your installers can do so automatically for them. That is why the conditional installations and .NET Framework requirements are there in the setup projects of Visual Studio.
The fact is also true for AutoCAD .NET assemblies. They are not supposed to be packaged up into the installer of your program and deployed along with your own assemblies. Even during debugging, we’d better set the Copy Local properties of AutoCAD .NET assemblies as False as well to avoid any tricky issues like AutoCAD loading multiple .NET API assembly copies into the same process or even worse different copies thus making your .NET applications not being loaded into the right process or your custom commands defined in them not being able to be found at all.
So please bear in mind to always set the Copy Local of the AutoCAD assemblies as False including both .NET API ones and COM interop ones, such as AcMgd.dll, AcDbMgd.dll, AcCui.dll, Autodesk.AutoCAD.Interop.dll and Autodesk.AutoCAD.Interop.Common.dll.
If you are using the leading edge AutoCAD .NET Addin Wizard (AcadNetAddinWizard), then no need to worry about all these at all in that the Copy Local properties of all AutoCAD .NET API assemblies and COM interop DLLs are set as False automatically.
Recent Comments