AutoCAD® .NET Load From Remote Sources

by Will on August 23, 2011

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.

Enter Your Mail Address

Be Sociable, Share!

{ 7 comments }

Michael Robertson August 23, 2011 at 2:55 pm

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 August 23, 2011 at 2:56 pm

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

Thanks,
Mike

Will August 25, 2011 at 8:08 pm

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 August 24, 2011 at 9:36 am

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

john coon August 24, 2011 at 11:18 am

Will,

Thanks that a great tip.

John

Anton September 16, 2011 at 6:35 pm

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 September 29, 2011 at 6:48 pm

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

Comments on this entry are closed.

Previous post:

Next post: