기본 콘텐츠로 건너뛰기

12월, 2013의 게시물 표시

.NET Automation

.NET Automation /// SP3D CommonMiddle Registry /// 13.12.12 static FormMain() { AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(MyResolveEventHandler); } /// /// SP3D CommonMiddle Registry /// /// 13.12.12 public static Assembly MyResolveEventHandler(object sender, ResolveEventArgs args) { //This handler is called only when the common language runtime tries to bind to the assembly and fails. //Retrieve the list of referenced assemblies in an array of AssemblyName. //Loop through the array of referenced assemblies. foreach (AssemblyName strAssmbName in Assembly.GetExecutingAssembly().GetReferencedAssemblies()) { //Look for the assembly names that have raised the "AssemblyResolve" event. if (((strAssmbName.Name.EndsWith("CommonMiddle")) /*&& (strAssmbName.FullName.Substring(0, strAssmbName.FullName.IndexOf(",")) == args.Name.Substring(0, args.Name.IndexOf(",")))) ? 1 : 0) != 0*/)) { //We only hav