/// <summary> /// Build a resolver array from a set of directories to resolve directly from. /// </summary> internal static Resolver[] CompileDirectories ( List <string> directories, FileExists fileExists, GetAssemblyName getAssemblyName, GetAssemblyRuntimeVersion getRuntimeVersion, Version targetedRuntimeVersion ) { var resolvers = new Resolver[directories.Count]; for (int i = 0; i < directories.Count; i++) { resolvers[i] = new DirectoryResolver(directories[i], getAssemblyName, fileExists, getRuntimeVersion, targetedRuntimeVersion); } return(resolvers); }
/// <summary> /// Compile search paths into an array of resolvers. /// </summary> /// <param name="buildEngine"></param> /// <param name="searchPaths"></param> /// <param name="candidateAssemblyFiles">Paths to assembly files mentioned in the project.</param> /// <param name="targetProcessorArchitecture">Like x86 or IA64\AMD64, the processor architecture being targetted.</param> /// <param name="frameworkPaths">Paths to FX folders.</param> /// <param name="fileExists"></param> /// <param name="getAssemblyName"></param> /// <param name="getRegistrySubKeyNames"></param> /// <param name="getRegistrySubKeyDefaultValue"></param> /// <param name="openBaseKey"></param> /// <param name="installedAssemblies"></param> /// <param name="getRuntimeVersion"></param> /// <param name="targetedRuntimeVersion"></param> /// <param name="getAssemblyPathInGac"></param> /// <param name="log"></param> /// <returns></returns> public static Resolver[] CompileSearchPaths ( IBuildEngine buildEngine, string[] searchPaths, string[] candidateAssemblyFiles, System.Reflection.ProcessorArchitecture targetProcessorArchitecture, string[] frameworkPaths, FileExists fileExists, GetAssemblyName getAssemblyName, #if FEATURE_WIN32_REGISTRY GetRegistrySubKeyNames getRegistrySubKeyNames, GetRegistrySubKeyDefaultValue getRegistrySubKeyDefaultValue, OpenBaseKey openBaseKey, #endif InstalledAssemblies installedAssemblies, GetAssemblyRuntimeVersion getRuntimeVersion, Version targetedRuntimeVersion, GetAssemblyPathInGac getAssemblyPathInGac, TaskLoggingHelper log ) { var resolvers = new Resolver[searchPaths.Length]; for (int p = 0; p < searchPaths.Length; ++p) { string basePath = searchPaths[p]; // Was {HintPathFromItem} specified? If so, take the Item's // HintPath property. if (0 == String.Compare(basePath, AssemblyResolutionConstants.hintPathSentinel, StringComparison.OrdinalIgnoreCase)) { resolvers[p] = new HintPathResolver(searchPaths[p], getAssemblyName, fileExists, getRuntimeVersion, targetedRuntimeVersion); } else if (0 == String.Compare(basePath, AssemblyResolutionConstants.frameworkPathSentinel, StringComparison.OrdinalIgnoreCase)) { resolvers[p] = new FrameworkPathResolver(frameworkPaths, installedAssemblies, searchPaths[p], getAssemblyName, fileExists, getRuntimeVersion, targetedRuntimeVersion); } else if (0 == String.Compare(basePath, AssemblyResolutionConstants.rawFileNameSentinel, StringComparison.OrdinalIgnoreCase)) { resolvers[p] = new RawFilenameResolver(searchPaths[p], getAssemblyName, fileExists, getRuntimeVersion, targetedRuntimeVersion); } else if (0 == String.Compare(basePath, AssemblyResolutionConstants.candidateAssemblyFilesSentinel, StringComparison.OrdinalIgnoreCase)) { resolvers[p] = new CandidateAssemblyFilesResolver(candidateAssemblyFiles, searchPaths[p], getAssemblyName, fileExists, getRuntimeVersion, targetedRuntimeVersion); } #if FEATURE_GAC else if (0 == String.Compare(basePath, AssemblyResolutionConstants.gacSentinel, StringComparison.OrdinalIgnoreCase)) { resolvers[p] = new GacResolver(targetProcessorArchitecture, searchPaths[p], getAssemblyName, fileExists, getRuntimeVersion, targetedRuntimeVersion, getAssemblyPathInGac); } #endif else if (0 == String.Compare(basePath, AssemblyResolutionConstants.assemblyFoldersSentinel, StringComparison.OrdinalIgnoreCase)) { resolvers[p] = new AssemblyFoldersResolver(searchPaths[p], getAssemblyName, fileExists, getRuntimeVersion, targetedRuntimeVersion); } #if FEATURE_WIN32_REGISTRY // Check for AssemblyFoldersEx sentinel. else if (0 == String.Compare(basePath, 0, AssemblyResolutionConstants.assemblyFoldersExSentinel, 0, AssemblyResolutionConstants.assemblyFoldersExSentinel.Length, StringComparison.OrdinalIgnoreCase)) { resolvers[p] = new AssemblyFoldersExResolver(searchPaths[p], getAssemblyName, fileExists, getRegistrySubKeyNames, getRegistrySubKeyDefaultValue, getRuntimeVersion, openBaseKey, targetedRuntimeVersion, targetProcessorArchitecture, true, buildEngine); } #endif else if (0 == String.Compare(basePath, 0, AssemblyResolutionConstants.assemblyFoldersFromConfigSentinel, 0, AssemblyResolutionConstants.assemblyFoldersFromConfigSentinel.Length, StringComparison.OrdinalIgnoreCase)) { resolvers[p] = new AssemblyFoldersFromConfigResolver(searchPaths[p], getAssemblyName, fileExists, getRuntimeVersion, targetedRuntimeVersion, targetProcessorArchitecture, true, buildEngine, log); } else { resolvers[p] = new DirectoryResolver(searchPaths[p], getAssemblyName, fileExists, getRuntimeVersion, targetedRuntimeVersion); } } return(resolvers); }