Ejemplo n.º 1
0
        /// <summary>
        /// Loads all the named assemblies into a cache of known assemblies
        /// </summary>
        private void LoadAssemblies()
        {
            _assemblies = new List <Assembly>();

            var loadedAssemblies = new Dictionary <string, Assembly>();

            //_assemblyFileNames.Reverse();

            foreach (string file in _assemblyFileNames)
            {
                // Pass 1 -- load all the assemblies we have been given.  No referenced assemblies yet.
                if (file.EndsWith("mscorlib.dll") || file.EndsWith("System.Runtime.dll"))
                {
                    continue;
                }

                var assembly = AssemblyUtilities.ReflectionOnlyLoadFrom(file, _logger);
                if (assembly != null)
                {
                    _assemblies.Add(assembly);

                    // Keep track of loaded assemblies for next step
                    loadedAssemblies[assembly.FullName] = assembly;
                }
            }

            // Pass 2 -- recursively load all reference assemblies from the assemblies we loaded.
            foreach (var assembly in _assemblies)
            {
                AssemblyUtilities.ReflectionOnlyLoadReferences(assembly, _assemblySearchPaths, loadedAssemblies, /*recursive*/ true, _logger);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Loads all the named assemblies into a cache of known assemblies
        /// </summary>
        private void LoadAssemblies()
        {
            this._assemblies = new List <Assembly>();
            Dictionary <string, Assembly> loadedAssemblies = new Dictionary <string, Assembly>();

            foreach (string file in this._assemblyFileNames)
            {
                // Pass 1 -- load all the assemblies we have been given.  No referenced assemblies yet.
                Assembly assembly = AssemblyUtilities.ReflectionOnlyLoadFrom(file, this._logger);
                if (assembly != null)
                {
                    this._assemblies.Add(assembly);

                    // Keep track of loaded assemblies for next step
                    loadedAssemblies[assembly.FullName] = assembly;
                }
            }

            // Pass 2 -- recursively load all reference assemblies from the assemblies we loaded.
            foreach (Assembly assembly in this._assemblies)
            {
                AssemblyUtilities.ReflectionOnlyLoadReferences(assembly, this._assemblySearchPaths, loadedAssemblies, /*recursive*/ true, this._logger);
            }
        }