I am trying to load an dll from network folder in my C# exe.
System.Reflection.Assembly assembly = System.Reflection.Assembly.LoadFile(xPath + “\” + t[0] + “.dll”);
I am getting the following error –
RefusedSet=""
Url=file://<network drive>/folder/raterType.dll
StackTrace:
at raterType.raterType.raterTypeCode(String a)
InnerException:
What Assembly settings do I have to do, to give full trust to the dll from my exe, so it loads it without any restrictions?
This is due to CAS policy. You need to give full trust permission.
If it does not work even after that, try to first load the file into memory (byte Array, using System.IO.File.ReadAllBytes()), and then load the assembly from in memory file data using the Assembly.Load() overload.