static void Main(string[] args) { if (args.Length < 1) { Log("Invalid arguments"); return; } try { var resolveMap = new Dictionary <AssemblyName, string> { { new AssemblyName("${ProcessDomainAssemblyName}"), args[0] } }; var resolver = new AssemblyResolver(resolveMap); resolver.Setup(); Type hostType = Type.GetType("${ActivatorHostTypeName}"); if (hostType == null) { throw new TypeLoadException(string.Format("Could not load ActivatorHost type '${ActivatorHostTypeName}' using resolver with '${ProcessDomainAssemblyName}' mapped to '{0}'", args[0])); } var methodInfo = hostType.GetMethod("Run", BindingFlags.Static | BindingFlags.Public, null, new[] { typeof(string[]) }, null); if (methodInfo == null) { throw new Exception("'Run' method on ActivatorHost not found."); } methodInfo.Invoke(null, new[] { args }); } catch (Exception ex) { Log("Failed to launch Activator Host: {0}", ex); } }
static void Main(string[] args) { if (args.Length < 1) { Log("Invalid arguments"); return; } try { var resolveMap = new Dictionary<AssemblyName, string> { { new AssemblyName("${ProcessDomainAssemblyName}"), args[0] } }; var resolver = new AssemblyResolver(resolveMap); resolver.Setup(); Type hostType = Type.GetType("${ActivatorHostTypeName}"); if (hostType == null) { throw new TypeLoadException(string.Format("Could not load ActivatorHost type '${ActivatorHostTypeName}' using resolver with '${ProcessDomainAssemblyName}' mapped to '{0}'", args[0])); } var methodInfo = hostType.GetMethod("Run", BindingFlags.Static | BindingFlags.Public, null, new[] { typeof(string[]) }, null); if(methodInfo == null) { throw new Exception("'Run' method on ActivatorHost not found."); } methodInfo.Invoke(null, new[] { args }); } catch (Exception ex) { Log("Failed to launch Activator Host: {0}", ex); } }