Note: Answering my own question as a wiki for future reference.

When loading a .Net DLL:

<< NetLink`
NETAssembly["XYZ", 1]

I get the error:

NET::netexcptn: A .NET exception occurred: System.IO.FileLoadException: Could not load file or assembly file:///C:\Temp\XYZ.dll'or one of its dependencies. Operation is not supported.(ExceptionfromHRESULT:0x80131515)

Filename:'file:///C:\Temp\XYZ.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....


2 Answers 2


The DLL file was Blocked.

The solution was to Unblock it (right click on DLL > choose Properties > click the Unblock button).

You need to restart Mathematica and load the DLL in again.

enter image description here


As per MSDN:

Note You may get a FileLoadException in a Windows Virtual PC application when you try to load a file from linked folders on the hosting computer. This error may also occur when you try to load a file from a folder linked over Remote Desktop Services (Terminal Services). To avoid the exception, set enabled to true.

I was able to resolve this problem using the <loadFromRemoteSources> Element and adding the settings to my config.

      <loadFromRemoteSources enabled="true"/>
  • 1
    $\begingroup$ Can you summarize the information in the link for this answer? $\endgroup$ Jul 19, 2016 at 7:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.