Answers for "Library dll unless netloaded by AutoCAD"

C#
0

Library dll unless netloaded by AutoCAD

public class Locator{	private string _path;	public Locator()	{	}	public void InstallLocator(string path)	{		_path = path;		AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(AssemblyResolve);	}	private Assembly AssemblyResolve(object sender, ResolveEventArgs args)	{		int position = args.Name.IndexOf(",");		if (position > -1)		{			try			{				string assemblyName = args.Name.Substring(0, position);				string assemblyFullPath = string.Empty;				//look in main folder				assemblyFullPath = _path + "\\" + assemblyName + ".dll";				if (File.Exists(assemblyFullPath))					return Assembly.LoadFrom(assemblyFullPath);			}			catch (Exception ex)			{				System.Diagnostics.Debug.WriteLine(ex.Message);			}		}		return null;	}}
Posted by: Guest on September-08-2021

C# Answers by Framework

Browse Popular Code Answers by Language