Loading Assemblies from Network Locations

.NET's default policy does not allow for loading of .NET assemblies (.dll files) from remote network locations. When attempting to load an assembly off a network path instead you get a network exception that complains about security policy.

You can override this behavior with a configuration setting in your EXE's .config file.

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

The key is the loadFromRemoteSource key which can be set to allow remote .DLL loading to occur.

Note that a .config file must be set up for whatever top level EXE file is running the application. This means:

  • YourApp.exe.config (your own EXE)
  • VFP9.exe.config (running VFP IDE)

Note: Config file <loadFromRemoteSources> only works in .NET 4.0 later. Older versions of .NET require use of the CASPOL.EXE tool to explicitly set policy for the executable or machine.


© West Wind Technologies, 1996-2022 • Updated: 04/05/18
Comment or report problem with topic