Error:
Exception Message: Could not load file or assembly 'file:///Z:\PROJECT\bin\Debug\XYZ.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)
Exception Message: 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 http://go.microsoft.com/fwlink/?LinkId=155569 for more information.
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 http://go.microsoft.com/fwlink/?LinkId=155569 for more information.
Solution:
It will be solved if you add a simple magic ;-) line to YOURPROJECT.exe.config file
- Open YOURPROJECT.exe.config file from bin folder
- Add <loadFromRemoteSources enabled="true" /> to <runtime> tag