Friday, April 1, 2011

Solution to System.IO.FileLoadException Could not load file or assembly error

I had a customer that downloaded a DLL to load in AutoCAD with NETLOAD having problem to get it work.
The solution to the error found at the bottom is to right click on the DLL file and click on Unblock button to the right of the text: This file came from another computer and might be blocked to help protect this computer.

If this does not work AlternateStreamView might work. Run it and delete all streams marked ":Zone.Identifier:$DATA" for the selected files (it might be .DLL, .ZIP, .EXE, .7z) to get rid of the security blocks.

Typical Error causing this problem found below:
Cannot load assembly. Error details: System.IO.FileLoadException: Could not
load file or assembly 'file:///C:\Users\JTB\AppData\Roaming\JTB
World\DimNotes\JTBDimNotes.dll' or one of its dependencies. Operation is not
supported. (Exception from HRESULT: 0x80131515)
File name: 'file:///C:\Users\JTB\AppData\Roaming\JTB
World\DimNotes\JTBDimNotes.dll' ---> System.NotSupportedException: An attempt
was made to load an assembly from a network location which would have caused
the assembly to be sandboxed in previous versions of the .NET Framework. This
release of the .NET Framework does not enable CAS policy by default, so this
load may be dangerous. If this load is not intended to sandbox the assembly,
please enable the loadFromRemoteSources switch. See for more information.
at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String
codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint,
StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean
forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName
assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean
forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile,
Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm
hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks,
StackCrawlMark& stackMark)
at System.Reflection.Assembly.LoadFrom(String assemblyFile)
at Autodesk.AutoCAD.Runtime.ExtensionLoader.Load(String fileName)
at loadmgd()

Some of the latest blog posts

Subscribe to RSS headline updates from:
Powered by FeedBurner