/// <summary> /// Loads assembly with given identity. /// </summary> /// <param name="identity">The assembly identity.</param> /// <param name="location">Location of the assembly.</param> /// <returns>Loaded assembly.</returns> public override Assembly Load(AssemblyIdentity identity, string location = null) { if (!string.IsNullOrEmpty(location)) { RegisterDependency(identity, location); } // Don't let the CLR load the assembly from the CodeBase (location), // which uses LoadFrom semantics (we want LoadFile): return Assembly.Load(identity.ToAssemblyName()); }
private static ModuleBuilder CreateDynamicModule(AssemblyBuilderAccess access, AssemblyIdentity name, string fileName) { var assemblyBuilder = AppDomain.CurrentDomain.DefineDynamicAssembly(name.ToAssemblyName(), access); if (DisableJitOptimizations) { assemblyBuilder.SetCustomAttribute(new CustomAttributeBuilder( typeof(DebuggableAttribute).GetConstructor(new[] { typeof(DebuggableAttribute.DebuggingModes) }), new object[] { DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations })); } const string moduleName = "InteractiveModule"; if (access == AssemblyBuilderAccess.RunAndSave) { return assemblyBuilder.DefineDynamicModule(moduleName, fileName, emitSymbolInfo: false); } else { return assemblyBuilder.DefineDynamicModule(moduleName, emitSymbolInfo: false); } }
public override Assembly Load(AssemblyIdentity identity, string location = null) { return Assembly.Load(identity.ToAssemblyName()); }