コード例 #1
0
        /** Load the Assembly into the current AppDomain. */
        internal override AssemblyRef LoadAssemblyFrom(AssemblyName an)
        {
            Trace.WriteLine("Loading a default assembly: " + an.FullName);
            AssemblyRef a = new AssemblyRef();

            a.Load(an);
            return(a);
        }
コード例 #2
0
        // Create the Assembly in its own AppDOmain.  In doing so, it
        // uses the custom paths (AppBase and Relative)
        // specified by the LoadAssemblyInfo object passed when this
        // object was created.
        internal override AssemblyRef LoadAssemblyFrom(AssemblyName an)
        {
            Trace.WriteLine("Loading a custom assembly for: " + an.FullName);
            String fname = "";

            //String.Format (Localization.FMT_APPDOMAIN_NAME,
            //  an.FullName);
            Trace.WriteLine("  -- Friendly Name of new AppDomain: " + fname);
            AppDomain ad = AppDomain.CreateDomain(
                an.FullName,      // friendlyName
                null,             // securityInfo
                m_info.AppPath(), // appBasePath
                m_info.RelPath(), // relativeSearchPath
                false             // shadowCopyFiles
                );

            m_ads.Add(ad);
            Trace.WriteLine("  -- created AppDomain");

            Type   t     = typeof(AssemblyRef);
            string aname = Assembly.GetExecutingAssembly().FullName;

            Trace.WriteLine("Assembly containing AssemblyRef: " + aname);
            Trace.WriteLine("Type full name: " + t.FullName);
            Trace.WriteLine("Type name: " + t.Name);

            ObjectHandle oh = ad.CreateInstance(
                aname,                                                             // Assembly file name
                t.FullName,                                                        // Type name
                false,                                                             // ignore case
                BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public, // binding attributes
                null,                                                              // binder
                null,                                                              // args
                null,                                                              // culture info
                null,                                                              // activation attributes
                Assembly.GetExecutingAssembly().Evidence                           // security attributes
                );

            AssemblyRef ar = (AssemblyRef)oh.Unwrap();

            ar.Load(an);
            return(ar);
        }