Exemplo n.º 1
0
        public static AssemblyProber Create(string name, bool isAssemblyName = false)
        {
            AppDomainSetup setup = new AppDomainSetup
            {
                ApplicationBase = isAssemblyName || string.IsNullOrWhiteSpace(name)
                                        ? Directory.GetCurrentDirectory()
                                        : Path.GetDirectoryName(Path.GetFullPath(name))
            };
            AppDomain tmpDomain = AppDomain.CreateDomain("Temporary AssemblyProber domain", null, setup);

            try
            {
                return(tmpDomain.CreateInstanceUsingPrivateConstructor <AssemblyProber>(name, isAssemblyName));
            }
            finally
            {
                AppDomain.Unload(tmpDomain);
            }
        }