public static Microsoft.Build.Tasks.Resolver[] CompileSearchPaths(string[] searchPaths, string[] candidateAssemblyFiles, ProcessorArchitecture targetProcessorArchitecture, string[] frameworkPaths, Microsoft.Build.Shared.FileExists fileExists, GetAssemblyName getAssemblyName, GetRegistrySubKeyNames getRegistrySubKeyNames, GetRegistrySubKeyDefaultValue getRegistrySubKeyDefaultValue, OpenBaseKey openBaseKey, InstalledAssemblies installedAssemblies, GetAssemblyRuntimeVersion getRuntimeVersion, Version targetedRuntimeVersion)
 {
     Microsoft.Build.Tasks.Resolver[] resolverArray = new Microsoft.Build.Tasks.Resolver[searchPaths.Length];
     for (int i = 0; i < searchPaths.Length; i++)
     {
         string strA = searchPaths[i];
         if (string.Compare(strA, "{hintpathfromitem}", StringComparison.OrdinalIgnoreCase) == 0)
         {
             resolverArray[i] = new HintPathResolver(searchPaths[i], getAssemblyName, fileExists, getRuntimeVersion, targetedRuntimeVersion);
         }
         else if (string.Compare(strA, "{targetframeworkdirectory}", StringComparison.OrdinalIgnoreCase) == 0)
         {
             resolverArray[i] = new FrameworkPathResolver(frameworkPaths, installedAssemblies, searchPaths[i], getAssemblyName, fileExists, getRuntimeVersion, targetedRuntimeVersion);
         }
         else if (string.Compare(strA, "{rawfilename}", StringComparison.OrdinalIgnoreCase) == 0)
         {
             resolverArray[i] = new RawFilenameResolver(searchPaths[i], getAssemblyName, fileExists, getRuntimeVersion, targetedRuntimeVersion);
         }
         else if (string.Compare(strA, "{candidateassemblyfiles}", StringComparison.OrdinalIgnoreCase) == 0)
         {
             resolverArray[i] = new CandidateAssemblyFilesResolver(candidateAssemblyFiles, searchPaths[i], getAssemblyName, fileExists, getRuntimeVersion, targetedRuntimeVersion);
         }
         else if (string.Compare(strA, "{gac}", StringComparison.OrdinalIgnoreCase) == 0)
         {
             resolverArray[i] = new GacResolver(targetProcessorArchitecture, searchPaths[i], getAssemblyName, fileExists, getRuntimeVersion, targetedRuntimeVersion);
         }
         else if (string.Compare(strA, "{assemblyfolders}", StringComparison.OrdinalIgnoreCase) == 0)
         {
             resolverArray[i] = new AssemblyFoldersResolver(searchPaths[i], getAssemblyName, fileExists, getRuntimeVersion, targetedRuntimeVersion);
         }
         else if (string.Compare(strA, 0, "{registry:", 0, "{registry:".Length, StringComparison.OrdinalIgnoreCase) == 0)
         {
             resolverArray[i] = new AssemblyFoldersExResolver(searchPaths[i], getAssemblyName, fileExists, getRegistrySubKeyNames, getRegistrySubKeyDefaultValue, getRuntimeVersion, openBaseKey, targetedRuntimeVersion, targetProcessorArchitecture, true);
         }
         else
         {
             resolverArray[i] = new DirectoryResolver(searchPaths[i], getAssemblyName, fileExists, getRuntimeVersion, targetedRuntimeVersion);
         }
     }
     return resolverArray;
 }
Example #2
0
 public static Microsoft.Build.Tasks.Resolver[] CompileSearchPaths(string[] searchPaths, string[] candidateAssemblyFiles, ProcessorArchitecture targetProcessorArchitecture, string[] frameworkPaths, Microsoft.Build.Shared.FileExists fileExists, GetAssemblyName getAssemblyName, GetRegistrySubKeyNames getRegistrySubKeyNames, GetRegistrySubKeyDefaultValue getRegistrySubKeyDefaultValue, OpenBaseKey openBaseKey, InstalledAssemblies installedAssemblies, GetAssemblyRuntimeVersion getRuntimeVersion, Version targetedRuntimeVersion)
 {
     Microsoft.Build.Tasks.Resolver[] resolverArray = new Microsoft.Build.Tasks.Resolver[searchPaths.Length];
     for (int i = 0; i < searchPaths.Length; i++)
     {
         string strA = searchPaths[i];
         if (string.Compare(strA, "{hintpathfromitem}", StringComparison.OrdinalIgnoreCase) == 0)
         {
             resolverArray[i] = new HintPathResolver(searchPaths[i], getAssemblyName, fileExists, getRuntimeVersion, targetedRuntimeVersion);
         }
         else if (string.Compare(strA, "{targetframeworkdirectory}", StringComparison.OrdinalIgnoreCase) == 0)
         {
             resolverArray[i] = new FrameworkPathResolver(frameworkPaths, installedAssemblies, searchPaths[i], getAssemblyName, fileExists, getRuntimeVersion, targetedRuntimeVersion);
         }
         else if (string.Compare(strA, "{rawfilename}", StringComparison.OrdinalIgnoreCase) == 0)
         {
             resolverArray[i] = new RawFilenameResolver(searchPaths[i], getAssemblyName, fileExists, getRuntimeVersion, targetedRuntimeVersion);
         }
         else if (string.Compare(strA, "{candidateassemblyfiles}", StringComparison.OrdinalIgnoreCase) == 0)
         {
             resolverArray[i] = new CandidateAssemblyFilesResolver(candidateAssemblyFiles, searchPaths[i], getAssemblyName, fileExists, getRuntimeVersion, targetedRuntimeVersion);
         }
         else if (string.Compare(strA, "{gac}", StringComparison.OrdinalIgnoreCase) == 0)
         {
             resolverArray[i] = new GacResolver(targetProcessorArchitecture, searchPaths[i], getAssemblyName, fileExists, getRuntimeVersion, targetedRuntimeVersion);
         }
         else if (string.Compare(strA, "{assemblyfolders}", StringComparison.OrdinalIgnoreCase) == 0)
         {
             resolverArray[i] = new AssemblyFoldersResolver(searchPaths[i], getAssemblyName, fileExists, getRuntimeVersion, targetedRuntimeVersion);
         }
         else if (string.Compare(strA, 0, "{registry:", 0, "{registry:".Length, StringComparison.OrdinalIgnoreCase) == 0)
         {
             resolverArray[i] = new AssemblyFoldersExResolver(searchPaths[i], getAssemblyName, fileExists, getRegistrySubKeyNames, getRegistrySubKeyDefaultValue, getRuntimeVersion, openBaseKey, targetedRuntimeVersion, targetProcessorArchitecture, true);
         }
         else
         {
             resolverArray[i] = new DirectoryResolver(searchPaths[i], getAssemblyName, fileExists, getRuntimeVersion, targetedRuntimeVersion);
         }
     }
     return(resolverArray);
 }
Example #3
0
        /// <summary>
        /// Compile search paths into an array of resolvers.
        /// </summary>
        /// <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="installedAssemblies"></param>
        /// <returns></returns>
        public static Resolver[] CompileSearchPaths
        (
            IBuildEngine buildEngine,
            string[] searchPaths,
            string[] candidateAssemblyFiles,
            System.Reflection.ProcessorArchitecture targetProcessorArchitecture,
            string[] frameworkPaths,
            FileExists fileExists,
            GetAssemblyName getAssemblyName,
            GetRegistrySubKeyNames getRegistrySubKeyNames,
            GetRegistrySubKeyDefaultValue getRegistrySubKeyDefaultValue,
            OpenBaseKey openBaseKey,
            InstalledAssemblies installedAssemblies,
            GetAssemblyRuntimeVersion getRuntimeVersion,
            Version targetedRuntimeVersion
        )
        {
            Resolver[] 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);
                }
                else if (0 == String.Compare(basePath, AssemblyResolutionConstants.gacSentinel, StringComparison.OrdinalIgnoreCase))
                {
                    resolvers[p] = new GacResolver(targetProcessorArchitecture, searchPaths[p], getAssemblyName, fileExists, getRuntimeVersion, targetedRuntimeVersion, buildEngine);
                }
                else if (0 == String.Compare(basePath, AssemblyResolutionConstants.assemblyFoldersSentinel, StringComparison.OrdinalIgnoreCase))
                {
                    resolvers[p] = new AssemblyFoldersResolver(searchPaths[p], getAssemblyName, fileExists, getRuntimeVersion, targetedRuntimeVersion);
                }
                // 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);
                }
                else
                {
                    resolvers[p] = new DirectoryResolver(searchPaths[p], getAssemblyName, fileExists, getRuntimeVersion, targetedRuntimeVersion);
                }
            }
            return(resolvers);
        }
Example #4
0
        /// <summary>
        /// Compile search paths into an array of resolvers.
        /// </summary>
        /// <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="installedAssemblies"></param>
        /// <returns></returns>
        public static Resolver[] CompileSearchPaths
        (
            IBuildEngine buildEngine,
            string[] searchPaths,
            string[] candidateAssemblyFiles,
            System.Reflection.ProcessorArchitecture targetProcessorArchitecture,
            string[] frameworkPaths,
            FileExists fileExists,
            GetAssemblyName getAssemblyName,
            GetRegistrySubKeyNames getRegistrySubKeyNames,
            GetRegistrySubKeyDefaultValue getRegistrySubKeyDefaultValue,
            OpenBaseKey openBaseKey,
            InstalledAssemblies installedAssemblies,
            GetAssemblyRuntimeVersion getRuntimeVersion,
            Version targetedRuntimeVersion
        )
        {
            Resolver[] 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);
                }
                else if (0 == String.Compare(basePath, AssemblyResolutionConstants.gacSentinel, StringComparison.OrdinalIgnoreCase))
                {
                    resolvers[p] = new GacResolver(targetProcessorArchitecture, searchPaths[p], getAssemblyName, fileExists, getRuntimeVersion, targetedRuntimeVersion, buildEngine);
                }
                else if (0 == String.Compare(basePath, AssemblyResolutionConstants.assemblyFoldersSentinel, StringComparison.OrdinalIgnoreCase))
                {
                    resolvers[p] = new AssemblyFoldersResolver(searchPaths[p], getAssemblyName, fileExists, getRuntimeVersion, targetedRuntimeVersion);
                }
                // 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);
                }
                else
                {
                    resolvers[p] = new DirectoryResolver(searchPaths[p], getAssemblyName, fileExists, getRuntimeVersion, targetedRuntimeVersion);
                }
            }
            return resolvers;
        }