AutoCAD® .NET Load From Remote Sources

William Forty
William Forty

There are various security features included in the .NET framework, and one of which prevents the loading of dll files from networked locations such as the Internet.

Whilst this is a very sensible idea, it can prevent us from achieving functionality that we want. For example, you may want to store your dll files in some networked location so that it is accessible by other members of your team. It is usually far more convenient to keep one central networked copy of a dll file than to have to duplicate it on all the machines that use it.

So, it would be handy if there was a way to override this security restriction, and of course, there is.

In your AutoCAD® directory (mine is C:\Program Files\Autodesk\AutoCAD® Civil 3D® 2012) there is a file called Acad.exe.Config - this is an xml document which sets out many configuration settings. Open this with any text editor (by the way, have you tried Notepad++ ?), and right before the final closing </configuration> tag, insert the following:

<runtime>
<loadFromRemoteSources enabled="true" />
</runtime>

Now once you restart AutoCAD®, you should be able to NETLOAD dll files from networked locations, and the management of your .NET programs is now that little bit easier.

Aren't you glad you came to HowToAutoCAD.com :D.

Will

P.S. If you want to benefit from my bountiful wisdom indefinitely (heh), I'd recommend subscribing below.


Comments

Michael Robertson
2011-08-23 14:55:40

If you already have your work station set to trust network locations using Microsofts CADPOL.exe do you still have to make the loadFromRemoteSources change?

Michael Robertson
2011-08-23 14:56:37

Sorry for my bad spelling, should have been CASPOL.exe (used for seting .NET security).

Thanks, Mike

Will
2011-08-25 20:08:40

To be honest with you Michael, I've no idea! Perhaps if you ever try this out you could let me know?

Thanks, Will

Peter Goodman
2011-08-24 09:36:57

Fantastic Will. As a new ARX kid this is certainly handy. All the best from Australia

john coon
2011-08-24 11:18:11

Will,

Thanks that a great tip.

John

Anton
2011-09-16 18:35:59

There is a reason why it is blocked, but it might be handy in some reasons. But I would advice to not load dlls from network drives if it is not needed.

Norman Yuan
2011-09-29 18:48:44

You only use this when your app runs with .NET 4. That is AutoCAD2012 or later (even you can let your Acad2010/11 add-in run under .NET 4 with acad.exe.cofig modified, there is always possible issue arising. Autodesk's previous claim that .NET API app always uses latest .NET was no longer true since Acad2011 and .NET 4 release).

Yes, even you configured a network location with CASPOL.exe, you still need to use or in Acad.exe.config. As you can see, there are two configuration attributes you can use. is a deal of "ALL" or "Nothing", while simply enable the CAS in .NET4.0, which is phasing out and is disabled in .NET 4 by default.

When we writing pure .NET 4 code (for Acad2012 or later), we should use .NET 4 code security model (sandboxing) if untrusted/partially trusted code would be involved.

Here is an link on topic that may be of help:

http://www.damirscorner.com/CodeAccessSecurityStrikesBackInNET4.aspx