Beispiel #1
0
        Assembly domain_AssemblyResolve(object sender, ResolveEventArgs args)
        {
            // Cerco di risolvere automaticamente
            AssemblyName name     = new AssemblyName(args.Name);
            string       fileName = Path.Combine(this.baseDir, name.Name + ".exe");

            if (!File.Exists(fileName))
            {
                fileName = Path.Combine(this.baseDir, name.Name + ".dll");
            }

            // Carico il percorso autocalcolato
            if (File.Exists(fileName))
            {
                return(Assembly.LoadFile(fileName));
            }

            if (AssemblyResolve != null)
            {
                AssemblyResolveEventArgs e = new AssemblyResolveEventArgs(args.Name, this.baseDir);
                AssemblyResolve(this, e);
                if (!String.IsNullOrEmpty(e.Location) && File.Exists(e.Location))
                {
                    return(Assembly.LoadFile(e.Location));
                }
            }

            return(null);
        }
        Assembly domain_AssemblyResolve(object sender, ResolveEventArgs args)
        {
            // Cerco di risolvere automaticamente
            AssemblyName name = new AssemblyName(args.Name);
            string fileName = Path.Combine(this.baseDir, name.Name + ".exe");
            if (!File.Exists(fileName))
                fileName = Path.Combine(this.baseDir, name.Name + ".dll");

            // Carico il percorso autocalcolato
            if (File.Exists(fileName))
                return Assembly.LoadFile(fileName);

            if (AssemblyResolve != null)
            {
                AssemblyResolveEventArgs e = new AssemblyResolveEventArgs(args.Name, this.baseDir);
                AssemblyResolve(this, e);
                if (!String.IsNullOrEmpty(e.Location) && File.Exists(e.Location))
                    return Assembly.LoadFile(e.Location);
            }

            return null;
        }