Esempio n. 1
0
 private IEnumerable <string> GetFlatNuGetReferenceFiles(Assembly assembly)
 {
     return(nuGetPackageResolver
            .GetPackageIds(assembly)
            .Select(_ => GetFilePath(_))
            .SelectMany(_ => GetReferencesForFile(_).Concat(new[] { _ })));
 }
Esempio n. 2
0
        /// <summary>
        /// Loads all the assemblies located in the working-dir.
        /// </summary>
        /// <inheritdoc />
        public void LoadAll()
        {
            var directory = new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory);

            var nuGetPackages = nuGetPackageResolver
                                .GetPackageIds(typeof(LibraryService).Assembly);

            var missingLibraries = directory.GetFiles()
                                   .Where(f => allowedExtensions.Contains(f.Extension, StringComparer.OrdinalIgnoreCase))
                                   .Where(f => !nuGetPackages.Contains(GetFileName(f), StringComparer.OrdinalIgnoreCase))
                                   .Where(f => !IsFileLoaded(f))
                                   .ToList();

            AppDomain.CurrentDomain.AssemblyResolve += ResolveAssembly;

            foreach (var library in missingLibraries)
            {
                var assembly = Assembly.LoadFile(library.FullName);

                foreach (var postProcessor in postProcessors)
                {
                    postProcessor.Process(assembly);
                }
            }
        }