Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You could load the assembly as bytes and load it with <code>Assembly.Load(bytes)</code>, maybe this works.</p> <p>Or you give the application the requested permission.</p> <h3>Edit:</h3> <p>I made a little test and it worked for me. Here is some code:</p> <pre><code>static Dictionary&lt;Assembly, String&gt; _Paths = new Dictionary&lt;Assembly, String&gt;(); static void Main(string[] args) { AppDomain current = AppDomain.CurrentDomain; current.AssemblyResolve += new ResolveEventHandler(HandleAssemblyResolve); // This line loads a assembly and retrieves all types of it. Only when // calling "GetTypes" the 'AssemblyResolve'-event occurs and loads the dependency Type[] types = LoadAssembly("Assemblies\\MyDLL.dll").GetTypes(); // The next line is used to test permissions, i tested the IO-Permissions // and the Reflection permissions ( which should be denied when using remote assemblies ) // Also this test includes the creation of a Form Object instance = Activator.CreateInstance(types[0]); } private static Assembly LoadAssembly(string file) { // Load the assembly Assembly result = Assembly.Load(File.ReadAllBytes(file)); // Add the path of the assembly to the dictionary _Paths.Add(result, Path.GetDirectoryName(file)); return result; } static Assembly HandleAssemblyResolve(object sender, ResolveEventArgs args) { // Extract file name from the full-quallified name String name = args.Name; name = name.Substring(0, name.IndexOf(',')); // Load the assembly return LoadAssembly(Path.Combine(_Paths[args.RequestingAssembly], name + ".dll")); } </code></pre> <h3>Something important:</h3> <p>There may be files which do not have a matching name and file name, but you can resolve this by checking all files in folder with <code>AssemblyName.GetAssemblyName(file)</code>.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload