public static RedistList GetRedistListFromPath(string path)
 {
     string[]            strArray       = (path == null) ? new string[0] : GetRedistListPathsFromDisk(path);
     AssemblyTableInfo[] assemblyTables = new AssemblyTableInfo[strArray.Length];
     for (int i = 0; i < strArray.Length; i++)
     {
         assemblyTables[i] = new AssemblyTableInfo(strArray[i], path);
     }
     return(GetRedistList(assemblyTables));
 }
        private static RedistList GetFrameworkListFromReferenceAssembliesPath(TargetDotNetFrameworkVersion version)
        {
            string pathToDotNetFrameworkReferenceAssemblies = ToolLocationHelper.GetPathToDotNetFrameworkReferenceAssemblies(version);

            string[]            strArray       = (pathToDotNetFrameworkReferenceAssemblies == null) ? new string[0] : GetRedistListPathsFromDisk(pathToDotNetFrameworkReferenceAssemblies);
            AssemblyTableInfo[] assemblyTables = new AssemblyTableInfo[strArray.Length];
            for (int i = 0; i < strArray.Length; i++)
            {
                assemblyTables[i] = new AssemblyTableInfo(strArray[i], pathToDotNetFrameworkReferenceAssemblies);
            }
            return(GetRedistList(assemblyTables));
        }
        public static RedistList GetFrameworkList20()
        {
            string pathToDotNetFramework = ToolLocationHelper.GetPathToDotNetFramework(TargetDotNetFrameworkVersion.Version20);

            string[] redistListPathsFromDisk = new string[0];
            if (pathToDotNetFramework != null)
            {
                redistListPathsFromDisk = GetRedistListPathsFromDisk(pathToDotNetFramework);
            }
            AssemblyTableInfo[] assemblyTables = new AssemblyTableInfo[redistListPathsFromDisk.Length];
            for (int i = 0; i < redistListPathsFromDisk.Length; i++)
            {
                assemblyTables[i] = new AssemblyTableInfo(redistListPathsFromDisk[i], pathToDotNetFramework);
            }
            return(GetRedistList(assemblyTables));
        }
 private void DumpTargetProfileLists(AssemblyTableInfo[] installedAssemblyTableInfo, AssemblyTableInfo[] whiteListSubsetTableInfo, ReferenceTable referenceTable)
 {
     if ((installedAssemblyTableInfo != null) && (Environment.GetEnvironmentVariable("MSBUILDDUMPFRAMEWORKSUBSETLIST") != null))
     {
         base.Log.LogMessageFromResources(MessageImportance.Low, "ResolveAssemblyReference.TargetFrameworkSubsetLogHeader", new object[0]);
         base.Log.LogMessageFromResources(MessageImportance.Low, "ResolveAssemblyReference.TargetFrameworkRedistLogHeader", new object[0]);
         if (installedAssemblyTableInfo != null)
         {
             foreach (AssemblyTableInfo info in installedAssemblyTableInfo)
             {
                 if (info != null)
                 {
                     base.Log.LogMessageFromResources(MessageImportance.Low, "ResolveAssemblyReference.FourSpaceIndent", new object[] { base.Log.FormatResourceString("ResolveAssemblyReference.FormattedAssemblyInfo", new object[] { info.Path }) });
                 }
             }
         }
         base.Log.LogMessageFromResources(MessageImportance.Low, "ResolveAssemblyReference.TargetFrameworkWhiteListLogHeader", new object[0]);
         if (whiteListSubsetTableInfo != null)
         {
             foreach (AssemblyTableInfo info2 in whiteListSubsetTableInfo)
             {
                 if (info2 != null)
                 {
                     base.Log.LogMessageFromResources(MessageImportance.Low, "ResolveAssemblyReference.FourSpaceIndent", new object[] { base.Log.FormatResourceString("ResolveAssemblyReference.FormattedAssemblyInfo", new object[] { info2.Path }) });
                 }
             }
         }
         if (referenceTable.ListOfExcludedAssemblies != null)
         {
             base.Log.LogMessageFromResources(MessageImportance.Low, "ResolveAssemblyReference.TargetFrameworkExclusionListLogHeader", new object[0]);
             foreach (string str2 in referenceTable.ListOfExcludedAssemblies)
             {
                 base.Log.LogMessageFromResources(MessageImportance.Low, "ResolveAssemblyReference.FourSpaceIndent", new object[] { str2 });
             }
         }
     }
 }
예제 #5
0
 /// <summary>
 /// Set the target framework paths.
 /// This is used to optimize IO in the case of files requested from one 
 /// of the FX folders.
 /// </summary>
 /// <param name="providedFrameworkPaths"></param>
 /// <param name="installedAssemblyTables"></param>
 internal void SetInstalledAssemblyInformation
 (
     AssemblyTableInfo[] installedAssemblyTableInfos
 )
 {
     _redistList = RedistList.GetRedistList(installedAssemblyTableInfos);
 }
예제 #6
0
        /// <summary>
        /// Log the target framework subset information.
        /// </summary>
        private void DumpTargetProfileLists(AssemblyTableInfo[] installedAssemblyTableInfo, AssemblyTableInfo[] whiteListSubsetTableInfo, ReferenceTable referenceTable)
        {
            if (installedAssemblyTableInfo != null)
            {
                string dumpFrameworkSubsetList = Environment.GetEnvironmentVariable("MSBUILDDUMPFRAMEWORKSUBSETLIST");

                if (dumpFrameworkSubsetList != null)
                {
                    Log.LogMessageFromResources(MessageImportance.Low, "ResolveAssemblyReference.TargetFrameworkSubsetLogHeader");

                    Log.LogMessageFromResources(MessageImportance.Low, "ResolveAssemblyReference.TargetFrameworkRedistLogHeader");
                    foreach (AssemblyTableInfo redistInfo in installedAssemblyTableInfo)
                    {
                        if (redistInfo != null)
                        {
                            Log.LogMessageFromResources(MessageImportance.Low, "ResolveAssemblyReference.FourSpaceIndent", Log.FormatResourceString("ResolveAssemblyReference.FormattedAssemblyInfo", redistInfo.Path));
                        }
                    }

                    Log.LogMessageFromResources(MessageImportance.Low, "ResolveAssemblyReference.TargetFrameworkWhiteListLogHeader");
                    if (whiteListSubsetTableInfo != null)
                    {
                        foreach (AssemblyTableInfo whiteListInfo in whiteListSubsetTableInfo)
                        {
                            if (whiteListInfo != null)
                            {
                                Log.LogMessageFromResources(MessageImportance.Low, "ResolveAssemblyReference.FourSpaceIndent", Log.FormatResourceString("ResolveAssemblyReference.FormattedAssemblyInfo", whiteListInfo.Path));
                            }
                        }
                    }

                    if (referenceTable.ListOfExcludedAssemblies != null)
                    {
                        Log.LogMessageFromResources(MessageImportance.Low, "ResolveAssemblyReference.TargetFrameworkExclusionListLogHeader");
                        foreach (string assemblyFullName in referenceTable.ListOfExcludedAssemblies)
                        {
                            Log.LogMessageFromResources(MessageImportance.Low, "ResolveAssemblyReference.FourSpaceIndent", assemblyFullName);
                        }
                    }
                }
            }
        }
 private AssemblyTableInfo[] GetInstalledAssemblyTableInfo(bool ignoreInstalledAssemblyTables, ITaskItem[] assemblyTables, GetListPath GetAssemblyListPaths, string[] targetFrameworkDirectories)
 {
     Dictionary<string, AssemblyTableInfo> dictionary = new Dictionary<string, AssemblyTableInfo>(StringComparer.OrdinalIgnoreCase);
     if (!ignoreInstalledAssemblyTables)
     {
         foreach (string str in targetFrameworkDirectories)
         {
             foreach (string str2 in GetAssemblyListPaths(str))
             {
                 dictionary[str2] = new AssemblyTableInfo(str2, str);
             }
         }
     }
     foreach (ITaskItem item in assemblyTables)
     {
         string metadata = item.GetMetadata("FrameworkDirectory");
         if (string.IsNullOrEmpty(metadata))
         {
             if ((this.TargetFrameworkDirectories != null) && (this.TargetFrameworkDirectories.Length == 1))
             {
                 metadata = this.TargetFrameworkDirectories[0];
             }
         }
         else
         {
             metadata = Microsoft.Build.Shared.FileUtilities.EnsureTrailingSlash(metadata);
         }
         dictionary[item.ItemSpec] = new AssemblyTableInfo(item.ItemSpec, metadata);
     }
     AssemblyTableInfo[] array = new AssemblyTableInfo[dictionary.Count];
     dictionary.Values.CopyTo(array, 0);
     return array;
 }
예제 #8
0
        public void VerifyGetSimpleNamesIsSorted()
        {
            string redistFile = FileUtilities.GetTemporaryFile();
            try
            {
                File.Delete(redistFile);
                File.WriteAllText
                    (
                        redistFile,
                        "<FileList Redist='Random' >" +
                        "<File AssemblyName='System' Version='10.0.0.0' PublicKeyToken='b77a5c561934e089' Culture='neutral' ProcessorArchitecture='MSIL' FileVersion='4.0.0.0' InGAC='true' />" +
                        "<File AssemblyName='System' Version='4.0.0.0' PublicKeyToken='b77a5c561934e089' Culture='neutral' ProcessorArchitecture='MSIL' FileVersion='4.0.0.0' InGAC='true' />" +
                        "<File AssemblyName='System' Version='3.0.0.0' PublicKeyToken='b77a5c561934e089' Culture='neutral' ProcessorArchitecture='MSIL' FileVersion='4.0.0.0' InGAC='true' />" +
                        "<File AssemblyName='System' Version='100.0.0.0' PublicKeyToken='b77a5c561934e089' Culture='neutral' ProcessorArchitecture='MSIL' FileVersion='4.0.0.0' InGAC='true' />" +
                        "<File AssemblyName='System' Version='1.0.0.0' PublicKeyToken='b77a5c561934e089' Culture='neutral' ProcessorArchitecture='MSIL' FileVersion='4.0.0.0' InGAC='true' />" +
                        "<File AssemblyName='System' Version='2.0.0.0' PublicKeyToken='b77a5c561934e089' Culture='neutral' ProcessorArchitecture='MSIL' FileVersion='4.0.0.0' InGAC='true' />" +
                        "</FileList >"
                    );

                AssemblyTableInfo tableInfo = new AssemblyTableInfo(redistFile, "DoesNotExist");
                RedistList redist = RedistList.GetRedistList(new AssemblyTableInfo[] { tableInfo });

                AssemblyEntry[] entryArray = redist.FindAssemblyNameFromSimpleName("System");
                Assert.Equal(6, entryArray.Length);
                AssemblyNameExtension a1 = new AssemblyNameExtension(entryArray[0].FullName);
                AssemblyNameExtension a2 = new AssemblyNameExtension(entryArray[1].FullName);
                AssemblyNameExtension a3 = new AssemblyNameExtension(entryArray[2].FullName);
                AssemblyNameExtension a4 = new AssemblyNameExtension(entryArray[3].FullName);
                AssemblyNameExtension a5 = new AssemblyNameExtension(entryArray[4].FullName);
                AssemblyNameExtension a6 = new AssemblyNameExtension(entryArray[5].FullName);

                Assert.True(a1.Version.Equals(new Version("100.0.0.0")), "Expect to find version 100.0.0.0 but instead found:" + a1.Version);
                Assert.True(a2.Version.Equals(new Version("10.0.0.0")), "Expect to find version 10.0.0.0 but instead found:" + a2.Version);
                Assert.True(a3.Version.Equals(new Version("4.0.0.0")), "Expect to find version 4.0.0.0 but instead found:" + a3.Version);
                Assert.True(a4.Version.Equals(new Version("3.0.0.0")), "Expect to find version 3.0.0.0 but instead found:" + a4.Version);
                Assert.True(a5.Version.Equals(new Version("2.0.0.0")), "Expect to find version 2.0.0.0 but instead found:" + a5.Version);
                Assert.True(a6.Version.Equals(new Version("1.0.0.0")), "Expect to find version 1.0.0.0 but instead found:" + a6.Version);
            }
            finally
            {
                File.Delete(redistFile);
            }
        }
예제 #9
0
        public void PartialNameMatchingFromRedist()
        {
            string redistFile = FileUtilities.GetTemporaryFile();

            try
            {
                File.Delete(redistFile);

                File.WriteAllText
                    (
                        redistFile,
                        "<FileList Redist='MyFancy-Redist' >" +
                        // Simple name match where everything is the same except for version
                        "<File AssemblyName='A' Version='1.0.0.0' PublicKeyToken='a5d015c7d5a0b012' Culture='de-DE' FileVersion='2.0.40824.0' InGAC='true' />" +
                        "<File AssemblyName='A' Version='2.0.0.0' PublicKeyToken='a5d015c7d5a0b012' Culture='neutral' FileVersion='2.0.40824.0' InGAC='true' />" +
                        "<File AssemblyName='A' Version='3.0.0.0' PublicKeyToken='null' Culture='de-DE' FileVersion='2.0.40824.0' InGAC='true' />" +
                        "</FileList >"
                    );

                AssemblyName v1 = new AssemblyName("A, Culture=de-DE, PublicKeyToken=a5d015c7d5a0b012, Version=1.0.0.0");
                AssemblyName v2 = new AssemblyName("A, Culture=Neutral, PublicKeyToken=a5d015c7d5a0b012, Version=2.0.0.0");
                AssemblyName v3 = new AssemblyName("A, Culture=de-DE, PublicKeyToken=null, Version=3.0.0.0");

                AssemblyNameExtension Av1 = new AssemblyNameExtension(v1);
                AssemblyNameExtension Av2 = new AssemblyNameExtension(v2);
                AssemblyNameExtension Av3 = new AssemblyNameExtension(v3);


                AssemblyTableInfo assemblyTableInfo = new AssemblyTableInfo(redistFile, "MyFrameworkDirectory");
                RedistList redistList = RedistList.GetRedistList(new AssemblyTableInfo[] { assemblyTableInfo });
                InstalledAssemblies installedAssemblies = new InstalledAssemblies(redistList);

                AssemblyNameExtension assemblyName = new AssemblyNameExtension("A");
                AssemblyNameExtension foundAssemblyName = FrameworkPathResolver.GetHighestVersionInRedist(installedAssemblies, assemblyName);
                Assert.True(foundAssemblyName.Equals(Av3));

                assemblyName = new AssemblyNameExtension("A, PublicKeyToken=a5d015c7d5a0b012");
                foundAssemblyName = FrameworkPathResolver.GetHighestVersionInRedist(installedAssemblies, assemblyName);
                Assert.True(foundAssemblyName.Equals(Av2));

                assemblyName = new AssemblyNameExtension("A, Culture=de-DE");
                foundAssemblyName = FrameworkPathResolver.GetHighestVersionInRedist(installedAssemblies, assemblyName);
                Assert.True(foundAssemblyName.Equals(Av3));

                assemblyName = new AssemblyNameExtension("A, PublicKeyToken=a5d015c7d5a0b012, Culture=de-DE");
                foundAssemblyName = FrameworkPathResolver.GetHighestVersionInRedist(installedAssemblies, assemblyName);
                Assert.True(foundAssemblyName.Equals(Av1));

                assemblyName = new AssemblyNameExtension("A, Version=17.0.0.0, PublicKeyToken=a5d015c7d5a0b012, Culture=de-DE");
                foundAssemblyName = FrameworkPathResolver.GetHighestVersionInRedist(installedAssemblies, assemblyName);
                Assert.True(foundAssemblyName.Equals(assemblyName));
            }
            finally
            {
                File.Delete(redistFile);
            }
        }
예제 #10
0
        public void ToElementButNoFrom()
        {
            string fullRedistListContents =
                "<Remap>" +
                "<To AssemblyName='System.Xml' Version='2.0.0.0' PublicKeyToken='b03f5f7f11d50a3a' Culture='Neutral' FileVersion='2.0.50727.208' InGAC='false' Retargetable='Yes'/>" +
                "</Remap>";

            string redistFile = Path.GetTempFileName();
            try
            {
                File.WriteAllText(redistFile, fullRedistListContents);

                AssemblyTableInfo info = new AssemblyTableInfo(redistFile, String.Empty);
                List<AssemblyEntry> assembliesReadIn = new List<AssemblyEntry>();
                List<AssemblyRemapping> remap = new List<AssemblyRemapping>();
                List<Exception> errors = new List<Exception>();
                List<string> errorFileNames = new List<string>();
                RedistList.ReadFile(info, assembliesReadIn, errors, errorFileNames, remap);
                Assert.Equal(0, errors.Count); // "Expected no Errors"
                Assert.Equal(0, errorFileNames.Count); // "Expected no Error file names"
                Assert.Equal(0, remap.Count);
            }
            finally
            {
                File.Delete(redistFile);
            }
        }
예제 #11
0
        public void FromElementButNoToElement()
        {
            string fullRedistListContents =
                "<Remap>" +
                "<From AssemblyName='System.Core' Version='2.0.0.0' PublicKeyToken='b03f5f7f11d50a3a' Culture='Neutral' FileVersion='2.0.50727.208' InGAC='false' Retargetable='Yes'/>" +
                "<From AssemblyName='System.Xml' Version='2.0.0.0' PublicKeyToken='b03f5f7f11d50a3a' Culture='Neutral' FileVersion='2.0.50727.208' InGAC='false' Retargetable='Yes'>" +
                "<To AssemblyName='Remapped' Version='2.0.0.0' PublicKeyToken='b03f5f7f11d50a3a' Culture='en-us' FileVersion='2.0.50727.208' InGAC='false'/>" +
                "</From>" +
                "</Remap>";

            string redistFile = Path.GetTempFileName();
            try
            {
                File.WriteAllText(redistFile, fullRedistListContents);

                AssemblyTableInfo info = new AssemblyTableInfo(redistFile, String.Empty);
                List<AssemblyEntry> assembliesReadIn = new List<AssemblyEntry>();
                List<AssemblyRemapping> remap = new List<AssemblyRemapping>();
                List<Exception> errors = new List<Exception>();
                List<string> errorFileNames = new List<string>();
                RedistList.ReadFile(info, assembliesReadIn, errors, errorFileNames, remap);
                Assert.Equal(0, errors.Count); // "Expected no Errors"
                Assert.Equal(0, errorFileNames.Count); // "Expected no Error file names"
                Assert.Equal(1, remap.Count);

                AssemblyRemapping pair = remap.First<AssemblyRemapping>();
                Assert.True(pair.From.Name.Equals("System.Xml", StringComparison.OrdinalIgnoreCase));
                Assert.True(pair.To.Name.Equals("Remapped", StringComparison.OrdinalIgnoreCase));
                Assert.True(pair.From.Retargetable);
                Assert.False(pair.To.Retargetable);
            }
            finally
            {
                File.Delete(redistFile);
            }
        }
예제 #12
0
        public void EmptyRemapping()
        {
            string fullRedistListContents = "<Remap/>";

            string redistFile = Path.GetTempFileName();
            try
            {
                File.WriteAllText(redistFile, fullRedistListContents);

                AssemblyTableInfo info = new AssemblyTableInfo(redistFile, String.Empty);
                List<AssemblyEntry> assembliesReadIn = new List<AssemblyEntry>();
                List<AssemblyRemapping> remap = new List<AssemblyRemapping>();
                List<Exception> errors = new List<Exception>();
                List<string> errorFileNames = new List<string>();
                RedistList.ReadFile(info, assembliesReadIn, errors, errorFileNames, remap);
                Assert.Equal(0, errors.Count); // "Expected no Errors"
                Assert.Equal(0, errorFileNames.Count); // "Expected no Error file names"
                Assert.Equal(0, remap.Count);
            }
            finally
            {
                File.Delete(redistFile);
            }
        }
예제 #13
0
        /// <summary>
        /// Expect to read in a certain number of redist list entries, this is factored out becase we went to test a number of input combinations which will all result in entries returned.
        /// </summary>
        private static List<AssemblyEntry> ExpectRedistEntries(string fullRedistListContentsDuplicates, int numberOfExpectedEntries, int numberofExpectedRemapEntries)
        {
            string redistFile = FileUtilities.GetTemporaryFile();
            List<AssemblyEntry> assembliesReadIn = new List<AssemblyEntry>();
            List<AssemblyRemapping> remapEntries = new List<AssemblyRemapping>();
            try
            {
                File.WriteAllText(redistFile, fullRedistListContentsDuplicates);

                AssemblyTableInfo info = new AssemblyTableInfo(redistFile, String.Empty);
                List<Exception> errors = new List<Exception>();
                List<string> errorFileNames = new List<string>();
                RedistList.ReadFile(info, assembliesReadIn, errors, errorFileNames, remapEntries);
                Assert.Equal(0, errors.Count); // "Expected no Errors"
                Assert.Equal(0, errorFileNames.Count); // "Expected no Error file names"
                Assert.Equal(assembliesReadIn.Count, numberOfExpectedEntries);
                Assert.Equal(remapEntries.Count, numberofExpectedRemapEntries);
            }
            finally
            {
                File.Delete(redistFile);
            }

            return assembliesReadIn;
        }
예제 #14
0
        public void TestDuplicateHandlingForRedistLists()
        {
            string fullRedistListContentsDuplicates =
                "<FileList Redist='Microsoft-Windows-CLRCoreComp' >" +
                "<File AssemblyName='System.Xml' Version='2.0.0.0' PublicKeyToken='b03f5f7f11d50a3a' Culture='Neutral' FileVersion='2.0.50727.208' InGAC='false' />" +
                "<File AssemblyName='System.Xml' Version='2.0.0.0' PublicKeyToken='b03f5f7f11d50a3a' Culture='Neutral' FileVersion='2.0.50727.208' InGAC='true' />" +
                "<File AssemblyName='System.XML' Version='3.0.0.0' PublicKeyToken='b03f5f7f11d50a3a' Culture='Neutral' FileVersion='2.0.50727.208' InGAC='false' />" +
                "<File AssemblyName='Microsoft.BuildEngine' Version='2.0.0.0' PublicKeyToken='b03f5f7f11d50a3a' Culture='Neutral' FileVersion='2.0.50727.208' InGAC='false' />" +
                "<File AssemblyName='Microsoft.BuildEngine' Version='2.0.0.0' PublicKeyToken='b03f5f7f11d50a3a' Culture='Neutral' FileVersion='2.0.50727.208' InGAC='true' />" +
                "<File AssemblyName='Microsoft.BuildEngine' Version='3.0.0.0' PublicKeyToken='b03f5f7f11d50a3a' Culture='Neutral' FileVersion='2.0.50727.208' InGAC='false' />" +
                "</FileList >";

            string redistFile = FileUtilities.GetTemporaryFile();
            try
            {
                File.WriteAllText(redistFile, fullRedistListContentsDuplicates);

                AssemblyTableInfo info = new AssemblyTableInfo(redistFile, String.Empty);
                List<AssemblyEntry> assembliesReadIn = new List<AssemblyEntry>();
                List<Exception> errors = new List<Exception>();
                List<string> errorFileNames = new List<string>();
                RedistList.ReadFile(info, assembliesReadIn, errors, errorFileNames, null);
                Assert.Equal(0, errors.Count); // "Expected no Errors"
                Assert.Equal(0, errorFileNames.Count); // "Expected no Error file names"
                Assert.Equal(4, assembliesReadIn.Count);
            }
            finally
            {
                File.Delete(redistFile);
            }
        }
예제 #15
0
        public void RedistListGenerateBlackListGoodListsCheckCaseInsensitive()
        {
            string redistFile = CreateGenericRedistList();
            string goodSubsetFile = FileUtilities.GetTemporaryFile();
            try
            {
                File.WriteAllText(goodSubsetFile, _engineAndXmlSubset.ToUpperInvariant());

                AssemblyTableInfo redistListInfo = new AssemblyTableInfo(redistFile, "TargetFrameworkDirectory");
                AssemblyTableInfo subsetListInfo = new AssemblyTableInfo(goodSubsetFile, "TargetFrameworkDirectory");
                RedistList redistList = RedistList.GetRedistList(new AssemblyTableInfo[] { redistListInfo });
                List<Exception> whiteListErrors = new List<Exception>();
                List<string> whiteListErrorFileNames = new List<string>();
                Hashtable blackList = redistList.GenerateBlackList(new AssemblyTableInfo[] { subsetListInfo }, whiteListErrors, whiteListErrorFileNames);

                // Since there were no white list expect the black list to return null
                Assert.Equal(0, blackList.Count); // "Expected to have no assemblies in the black list"
                Assert.Equal(0, whiteListErrors.Count); // "Expected there to be no error in the whiteListErrors"
                Assert.Equal(0, whiteListErrorFileNames.Count); // "Expected there to be no error in the whiteListErrorFileNames"
            }
            finally
            {
                File.Delete(redistFile);
                File.Delete(goodSubsetFile);
            }
        }
예제 #16
0
        public void RedistListGenerateBlackListGoodListsMultipleIdenticalAssembliesInRedistList()
        {
            string redistFile = FileUtilities.GetTemporaryFile();
            string goodSubsetFile = FileUtilities.GetTemporaryFile();
            try
            {
                // Create a redist list which will contains both of the assemblies to search for
                string redistListContents =
                    "<FileList Redist='Microsoft-Windows-CLRCoreComp' >" +
                    "<File AssemblyName='System.Xml' Version='2.0.0.0' PublicKeyToken='b03f5f7f11d50a3a' Culture='Neutral' FileVersion='2.0.50727.208' InGAC='true' />" +
                    "<File AssemblyName='Microsoft.Build.Engine' Version='2.0.0.0' PublicKeyToken='b03f5f7f11d50a3a' Culture='Neutral' FileVersion='2.0.50727.208' InGAC='true' />" +
                    "<File AssemblyName='Microsoft.Build.Engine' Version='2.0.0.0' PublicKeyToken='b03f5f7f11d50a3a' Culture='Neutral' FileVersion='2.0.50727.208' InGAC='true' />" +
                    "</FileList >";

                File.WriteAllText(redistFile, redistListContents);
                File.WriteAllText(goodSubsetFile, _engineAndXmlSubset);

                AssemblyTableInfo redistListInfo = new AssemblyTableInfo(redistFile, "TargetFrameworkDirectory");
                AssemblyTableInfo subsetListInfo = new AssemblyTableInfo(goodSubsetFile, "TargetFrameworkDirectory");
                RedistList redistList = RedistList.GetRedistList(new AssemblyTableInfo[] { redistListInfo });
                List<Exception> whiteListErrors = new List<Exception>();
                List<string> whiteListErrorFilesNames = new List<string>();
                Hashtable blackList = redistList.GenerateBlackList(new AssemblyTableInfo[] { subsetListInfo }, whiteListErrors, whiteListErrorFilesNames);

                // Since there were no white list expect the black list to return null
                Assert.Equal(0, blackList.Count); // "Expected to have no assemblies in the black list"
                Assert.Equal(0, whiteListErrors.Count); // "Expected there to be no error in the whiteListErrors"
                Assert.Equal(0, whiteListErrorFilesNames.Count); // "Expected there to be no error in the whiteListErrorFileNames"
            }
            finally
            {
                File.Delete(redistFile);
                File.Delete(goodSubsetFile);
            }
        }
예제 #17
0
        public void RedistListGenerateBlackListEmptyAssemblyInfoWithRedistAssemblies()
        {
            string redistFile = CreateGenericRedistList();
            try
            {
                AssemblyTableInfo redistListInfo = new AssemblyTableInfo(redistFile, "TargetFrameworkDirectory");
                RedistList redistList = RedistList.GetRedistList(new AssemblyTableInfo[] { redistListInfo });
                List<Exception> whiteListErrors = new List<Exception>();
                List<string> whiteListErrorFileNames = new List<string>();
                Hashtable blackList = redistList.GenerateBlackList(new AssemblyTableInfo[0], whiteListErrors, whiteListErrorFileNames);


                // Since there were no white list expect the black list to return null
                Assert.Equal(0, blackList.Count); // "Expected to have no assemblies in the black list"
            }
            finally
            {
                File.Delete(redistFile);
            }
        }
예제 #18
0
        public void VerifyAssemblyInRedistListDiffSimpleName()
        {
            string redistFile = FileUtilities.GetTemporaryFile();
            try
            {
                File.Delete(redistFile);
                File.WriteAllText
                    (
                        redistFile,
                        "<FileList Redist='Microsoft-Windows-CLRCoreComp-Random' >" +
                        "<File AssemblyName='System' Version='10.0.0.0' PublicKeyToken='b77a5c561934e089' Culture='neutral' ProcessorArchitecture='MSIL' FileVersion='4.0.0.0' InGAC='true' />" +
                        "</FileList >"
                    );

                AssemblyTableInfo tableInfo = new AssemblyTableInfo(redistFile, "DoesNotExist");
                RedistList redist = RedistList.GetRedistList(new AssemblyTableInfo[] { tableInfo });

                AssemblyNameExtension a1 = new AssemblyNameExtension("Something, Version=10.0.0.0, Culture=Neutral, PublicKeyToken='b77a5c561934e089'");
                bool inRedistList = redist.FrameworkAssemblyEntryInRedist(a1);
                Assert.False(inRedistList);
            }
            finally
            {
                File.Delete(redistFile);
            }
        }
예제 #19
0
        public void RedistListGenerateBlackListNotFoundSubsetFiles()
        {
            string redistFile = CreateGenericRedistList();
            try
            {
                AssemblyTableInfo redistListInfo = new AssemblyTableInfo(redistFile, "TargetFrameworkDirectory");
                RedistList redistList = RedistList.GetRedistList(new AssemblyTableInfo[] { redistListInfo });
                List<Exception> whiteListErrors = new List<Exception>();
                List<string> whiteListErrorFileNames = new List<string>();

                Hashtable blackList = redistList.GenerateBlackList(
                    new AssemblyTableInfo[]
                    {
                        new AssemblyTableInfo("c:\\RandomDirectory.xml", "TargetFrameworkDirectory"),
                        new AssemblyTableInfo("c:\\AnotherRandomDirectory.xml", "TargetFrameworkDirectory")
                    },
                    whiteListErrors,
                    whiteListErrorFileNames
                    );

                // Since there were no white list expect the black list to return null
                Assert.Equal(0, blackList.Count); // "Expected to have no assemblies in the black list"
                Assert.Equal(2, whiteListErrors.Count); // "Expected there to be two errors in the whiteListErrors, one for each missing file"
                Assert.Equal(2, whiteListErrorFileNames.Count); // "Expected there to be two errors in the whiteListErrorFileNames, one for each missing file"
            }
            finally
            {
                File.Delete(redistFile);
            }
        }
 private void HandleProfile(AssemblyTableInfo[] installedAssemblyTableInfo, out AssemblyTableInfo[] fullRedistAssemblyTableInfo, out Hashtable blackList, out RedistList fullFrameworkRedistList)
 {
     fullFrameworkRedistList = null;
     blackList = null;
     fullRedistAssemblyTableInfo = null;
     foreach (ITaskItem item in this.FullFrameworkAssemblyTables)
     {
         if (string.IsNullOrEmpty(item.GetMetadata("FrameworkDirectory")))
         {
             base.Log.LogErrorWithCodeFromResources("ResolveAssemblyReference.FrameworkDirectoryOnProfiles", new object[] { item.ItemSpec });
             return;
         }
     }
     fullRedistAssemblyTableInfo = this.GetInstalledAssemblyTableInfo(false, this.FullFrameworkAssemblyTables, new GetListPath(RedistList.GetRedistListPathsFromDisk), this.FullFrameworkFolders);
     if (fullRedistAssemblyTableInfo.Length > 0)
     {
         fullFrameworkRedistList = RedistList.GetRedistList(fullRedistAssemblyTableInfo);
         if (fullFrameworkRedistList != null)
         {
             base.Log.LogMessageFromResources("ResolveAssemblyReference.ProfileExclusionListWillBeGenerated", new object[0]);
             blackList = fullFrameworkRedistList.GenerateBlackList(installedAssemblyTableInfo);
         }
         if (blackList == null)
         {
             base.Log.LogWarningWithCodeFromResources("ResolveAssemblyReference.NoRedistAssembliesToGenerateExclusionList", new object[0]);
         }
     }
     else
     {
         base.Log.LogWarningWithCodeFromResources("ResolveAssemblyReference.NoProfilesFound", new object[0]);
     }
     if (fullFrameworkRedistList != null)
     {
         for (int i = 0; i < fullFrameworkRedistList.Errors.Length; i++)
         {
             Exception exception = fullFrameworkRedistList.Errors[i];
             string str = fullFrameworkRedistList.ErrorFileNames[i];
             base.Log.LogWarningWithCodeFromResources("ResolveAssemblyReference.InvalidProfileRedistLocation", new object[] { str, RedistList.RedistListFolder, exception.Message });
         }
     }
 }
예제 #21
0
        public void RedistListGenerateBlackListGarbageSubsetListFiles()
        {
            string redistFile = CreateGenericRedistList();
            string garbageSubsetFile = FileUtilities.GetTemporaryFile();
            try
            {
                File.WriteAllText
                    (
                        garbageSubsetFile,
                        "RandomGarbage, i am a bad file with random goo rather than anything important"
                    );

                AssemblyTableInfo redistListInfo = new AssemblyTableInfo(redistFile, "TargetFrameworkDirectory");
                AssemblyTableInfo subsetListInfo = new AssemblyTableInfo(garbageSubsetFile, "TargetFrameworkDirectory");
                RedistList redistList = RedistList.GetRedistList(new AssemblyTableInfo[] { redistListInfo });
                List<Exception> whiteListErrors = new List<Exception>();
                List<string> whiteListErrorFileNames = new List<string>();
                Hashtable blackList = redistList.GenerateBlackList(new AssemblyTableInfo[] { subsetListInfo }, whiteListErrors, whiteListErrorFileNames);

                Assert.Equal(0, blackList.Count); // "Expected to have no assemblies in the black list"
                Assert.Equal(1, whiteListErrors.Count); // "Expected there to be an error in the whiteListErrors"
                Assert.Equal(1, whiteListErrorFileNames.Count); // "Expected there to be an error in the whiteListErrorFileNames"
                Assert.False(((Exception)whiteListErrors[0]).Message.Contains("MSB3257")); // "Expect to not have the null redist warning"
            }
            finally
            {
                File.Delete(redistFile);
                File.Delete(garbageSubsetFile);
            }
        }
예제 #22
0
        /// <summary>
        /// For a given profile generate the exclusion list and return the list of redist list files read in so they can be logged at the end of the task execution.
        /// </summary>
        /// <param name="installedAssemblyTableInfo">Installed assembly info of the profile redist lists</param>
        /// <param name="fullRedistAssemblyTableInfo">Installed assemblyInfo for the full framework redist lists</param>
        /// <param name="blackList">Generated exclusion list</param>
        private void HandleProfile(AssemblyTableInfo[] installedAssemblyTableInfo, out AssemblyTableInfo[] fullRedistAssemblyTableInfo, out Hashtable blackList, out RedistList fullFrameworkRedistList)
        {
            // Redist list which will contain the full framework redist list.
            fullFrameworkRedistList = null;
            blackList = null;
            fullRedistAssemblyTableInfo = null;

            // Make sure the framework directory is on the FullFrameworkTablesLocation if it is being used.
            foreach (ITaskItem item in FullFrameworkAssemblyTables)
            {
                // Cannot be missing the FrameworkDirectory if we are using this property
                if (String.IsNullOrEmpty(item.GetMetadata("FrameworkDirectory")))
                {
                    Log.LogErrorWithCodeFromResources("ResolveAssemblyReference.FrameworkDirectoryOnProfiles", item.ItemSpec);
                    return;
                }
            }

            fullRedistAssemblyTableInfo = GetInstalledAssemblyTableInfo(false, FullFrameworkAssemblyTables, new GetListPath(RedistList.GetRedistListPathsFromDisk), FullFrameworkFolders);
            if (fullRedistAssemblyTableInfo.Length > 0)
            {
                // Get the redist list which represents the Full framework, we need this so that we can generate the exclusion list
                fullFrameworkRedistList = RedistList.GetRedistList(fullRedistAssemblyTableInfo);
                if (fullFrameworkRedistList != null)
                {
                    // Generate the black list by determining what assemblies are in the full framework but not in the profile.
                    // The installedAssemblyTableInfo is the list of xml files for the Client Profile redist, these are the whitelist xml files.
                    Log.LogMessageFromResources("ResolveAssemblyReference.ProfileExclusionListWillBeGenerated");

                    // Any errors reading the profile redist list will already be logged, we do not need to re-log the errors here.
                    List<Exception> whiteListErrors = new List<Exception>();
                    List<string> whiteListErrorFilesNames = new List<string>();
                    blackList = fullFrameworkRedistList.GenerateBlackList(installedAssemblyTableInfo, whiteListErrors, whiteListErrorFilesNames);
                }

                // Could get into this situation if the redist list files were full of junk and no assemblies were read in.
                if (blackList == null)
                {
                    Log.LogWarningWithCodeFromResources("ResolveAssemblyReference.NoRedistAssembliesToGenerateExclusionList");
                }
            }
            else
            {
                Log.LogWarningWithCodeFromResources("ResolveAssemblyReference.NoProfilesFound");
            }

            if (fullFrameworkRedistList != null)
            {
                // Any errors logged for the client profile redist list will have been logged after this method returns.
                // Some files may have been skipped. Log warnings for these.
                for (int i = 0; i < fullFrameworkRedistList.Errors.Length; ++i)
                {
                    Exception e = fullFrameworkRedistList.Errors[i];
                    string filename = fullFrameworkRedistList.ErrorFileNames[i];

                    // Give the user a warning about the bad file (or files).
                    Log.LogWarningWithCodeFromResources("ResolveAssemblyReference.InvalidProfileRedistLocation", filename, RedistList.RedistListFolder, e.Message);
                }
            }
        }
예제 #23
0
        public void RedistListNoSubsetListName()
        {
            string redistFile = CreateGenericRedistList();
            string subsetFile = FileUtilities.GetTemporaryFile();
            try
            {
                string subsetListContents =
                    "<FileList>" +
                    "<File AssemblyName='System.Xml' Version='2.0.0.0' PublicKeyToken='b03f5f7f11d50a3a' Culture='Neutral' FileVersion='2.0.50727.208' InGAC='true' />" +
                    "<File AssemblyName='Microsoft.Build.Engine' Version='2.0.0.0' PublicKeyToken='b03f5f7f11d50a3a' Culture='Neutral' FileVersion='2.0.50727.208' InGAC='true' />" +
                    "</FileList >";
                File.WriteAllText(subsetFile, subsetListContents);



                AssemblyTableInfo redistListInfo = new AssemblyTableInfo(redistFile, "TargetFrameworkDirectory");
                AssemblyTableInfo subsetListInfo = new AssemblyTableInfo(subsetFile, "TargetFrameworkDirectory");
                RedistList redistList = RedistList.GetRedistList(new AssemblyTableInfo[] { redistListInfo });
                List<Exception> whiteListErrors = new List<Exception>();
                List<string> whiteListErrorFileNames = new List<string>();
                Hashtable blackList = redistList.GenerateBlackList(new AssemblyTableInfo[] { subsetListInfo }, whiteListErrors, whiteListErrorFileNames);

                // If the names do not match then i expect there to be no black list items
                Assert.Equal(0, blackList.Count); // "Expected to have no assembly in the black list"
                Assert.Equal(1, whiteListErrors.Count); // "Expected there to be one error in the whiteListErrors"
                Assert.Equal(1, whiteListErrorFileNames.Count); // "Expected there to be one error in the whiteListErrorFileNames"
                string message = ResourceUtilities.FormatResourceString("ResolveAssemblyReference.NoSubSetRedistListName", subsetFile);
                Assert.True(((Exception)whiteListErrors[0]).Message.Contains(message)); // "Expected assertion to contain correct error code"
            }
            finally
            {
                File.Delete(redistFile);
                File.Delete(subsetFile);
            }
        }
예제 #24
0
        /// <summary>
        /// Process TargetFrameworkDirectories and an array of InstalledAssemblyTables.
        /// The goal is this:  for each installed assembly table (whether found on disk
        /// or given as an input), we wish to determine the target framework directory
        /// it is associated with.
        /// </summary>
        /// <returns>Array of AssemblyTableInfo objects (Describe the path and framework directory of a redist or subset list xml file) </returns>
        private AssemblyTableInfo[] GetInstalledAssemblyTableInfo(bool ignoreInstalledAssemblyTables, ITaskItem[] assemblyTables, GetListPath GetAssemblyListPaths, string[] targetFrameworkDirectories)
        {
            Dictionary<string, AssemblyTableInfo> tableMap = new Dictionary<string, AssemblyTableInfo>(StringComparer.OrdinalIgnoreCase);

            if (!ignoreInstalledAssemblyTables)
            {
                // first, find redist or subset files underneath the TargetFrameworkDirectories
                foreach (string targetFrameworkDirectory in targetFrameworkDirectories)
                {
                    string[] listPaths = GetAssemblyListPaths(targetFrameworkDirectory);
                    foreach (string listPath in listPaths)
                    {
                        tableMap[listPath] = new AssemblyTableInfo(listPath, targetFrameworkDirectory);
                    }
                }
            }

            // now process those provided as inputs from the project file
            foreach (ITaskItem installedAssemblyTable in assemblyTables)
            {
                string frameworkDirectory = installedAssemblyTable.GetMetadata(ItemMetadataNames.frameworkDirectory);

                // Whidbey behavior was to accept a single TargetFrameworkDirectory, and multiple
                // InstalledAssemblyTables, under the assumption that all of the InstalledAssemblyTables
                // were related to the single TargetFrameworkDirectory.  If inputs look like the Whidbey
                // case, let's make sure we behave the same way.

                if (String.IsNullOrEmpty(frameworkDirectory))
                {
                    if (TargetFrameworkDirectories != null && TargetFrameworkDirectories.Length == 1)
                    {
                        // Exactly one TargetFrameworkDirectory, so assume it's related to this
                        // InstalledAssemblyTable.

                        frameworkDirectory = TargetFrameworkDirectories[0];
                    }
                }
                else
                {
                    // The metadata on the item was non-empty, so use it.
                    frameworkDirectory = FileUtilities.EnsureTrailingSlash(frameworkDirectory);
                }

                tableMap[installedAssemblyTable.ItemSpec] = new AssemblyTableInfo(installedAssemblyTable.ItemSpec, frameworkDirectory);
            }

            AssemblyTableInfo[] extensions = new AssemblyTableInfo[tableMap.Count];
            tableMap.Values.CopyTo(extensions, 0);

            return extensions;
        }
예제 #25
0
        public void RedistListDifferentNameToSubSet()
        {
            string redistFile = CreateGenericRedistList();
            string subsetFile = FileUtilities.GetTemporaryFile();
            try
            {
                string subsetListContents =
                    "<FileList Redist='IAMREALLYREALLYDIFFERNT' >" +
                    "<File AssemblyName='System.Xml' Version='2.0.0.0' PublicKeyToken='b03f5f7f11d50a3a' Culture='Neutral' FileVersion='2.0.50727.208' InGAC='true' />" +
                    "<File AssemblyName='Microsoft.Build.Engine' Version='2.0.0.0' PublicKeyToken='b03f5f7f11d50a3a' Culture='Neutral' FileVersion='2.0.50727.208' InGAC='true' />" +
                    "</FileList >";
                File.WriteAllText(subsetFile, subsetListContents);



                AssemblyTableInfo redistListInfo = new AssemblyTableInfo(redistFile, "TargetFrameworkDirectory");
                AssemblyTableInfo subsetListInfo = new AssemblyTableInfo(subsetFile, "TargetFrameworkDirectory");
                RedistList redistList = RedistList.GetRedistList(new AssemblyTableInfo[] { redistListInfo });
                List<Exception> whiteListErrors = new List<Exception>();
                List<string> whiteListErrorFileNames = new List<string>();
                Hashtable blackList = redistList.GenerateBlackList(new AssemblyTableInfo[] { subsetListInfo }, whiteListErrors, whiteListErrorFileNames);

                // If the names do not match then i expect there to be no black list items
                Assert.Equal(0, blackList.Count); // "Expected to have no assembly in the black list"
                Assert.Equal(0, whiteListErrors.Count); // "Expected there to be no error in the whiteListErrors"
                Assert.Equal(0, whiteListErrorFileNames.Count); // "Expected there to be no error in the whiteListErrorFileNames"
            }
            finally
            {
                File.Delete(redistFile);
                File.Delete(subsetFile);
            }
        }
예제 #26
0
        public void RedistListEmptySubsetMatchingName()
        {
            string redistFile = CreateGenericRedistList();
            string subsetFile = FileUtilities.GetTemporaryFile();
            try
            {
                string subsetListContents =
                    "<FileList Redist='Microsoft-Windows-CLRCoreComp' >" +
                    "</FileList >";
                File.WriteAllText(subsetFile, subsetListContents);

                AssemblyTableInfo redistListInfo = new AssemblyTableInfo(redistFile, "TargetFrameworkDirectory");
                AssemblyTableInfo subsetListInfo = new AssemblyTableInfo(subsetFile, "TargetFrameworkDirectory");
                RedistList redistList = RedistList.GetRedistList(new AssemblyTableInfo[] { redistListInfo });
                List<Exception> whiteListErrors = new List<Exception>();
                List<string> whiteListErrorFileNames = new List<string>();
                Hashtable blackList = redistList.GenerateBlackList(new AssemblyTableInfo[] { subsetListInfo }, whiteListErrors, whiteListErrorFileNames);

                // If the names do not match then i expect there to be no black list items
                Assert.Equal(2, blackList.Count); // "Expected to have two assembly in the black list"
                Assert.Equal(0, whiteListErrors.Count); // "Expected there to be no error in the whiteListErrors"
                Assert.Equal(0, whiteListErrorFileNames.Count); // "Expected there to be no error in the whiteListErrorFileNames"

                ArrayList whiteListErrors2 = new ArrayList();
                ArrayList whiteListErrorFileNames2 = new ArrayList();
                Hashtable blackList2 = redistList.GenerateBlackList(new AssemblyTableInfo[] { subsetListInfo }, whiteListErrors, whiteListErrorFileNames);
                Assert.Same(blackList, blackList2);
            }
            finally
            {
                File.Delete(redistFile);
                File.Delete(subsetFile);
            }
        }
예제 #27
0
        public void RedistListGenerateBlackListVerifyBlackListCache()
        {
            string redistFile = CreateGenericRedistList();
            string goodSubsetFile = FileUtilities.GetTemporaryFile();
            try
            {
                File.WriteAllText(goodSubsetFile, _engineOnlySubset);

                AssemblyTableInfo redistListInfo = new AssemblyTableInfo(redistFile, "TargetFrameworkDirectory");
                AssemblyTableInfo subsetListInfo = new AssemblyTableInfo(goodSubsetFile, "TargetFrameworkDirectory");
                RedistList redistList = RedistList.GetRedistList(new AssemblyTableInfo[] { redistListInfo });
                List<Exception> whiteListErrors = new List<Exception>();
                List<string> whiteListErrorFileNames = new List<string>();
                Hashtable blackList = redistList.GenerateBlackList(new AssemblyTableInfo[] { subsetListInfo }, whiteListErrors, whiteListErrorFileNames);

                // Since there were no white list expect the black list to return null
                Assert.Equal(1, blackList.Count); // "Expected to have one assembly in the black list"
                Assert.True(blackList.ContainsKey("System.Xml, Version=2.0.0.0, Culture=Neutral, PublicKeyToken=b03f5f7f11d50a3a")); // "Expected System.xml to be in the black list"
                Assert.Equal(0, whiteListErrors.Count); // "Expected there to be no error in the whiteListErrors"
                Assert.Equal(0, whiteListErrorFileNames.Count); // "Expected there to be no error in the whiteListErrorFileNames"

                List<Exception> whiteListErrors2 = new List<Exception>();
                List<string> whiteListErrorFileNames2 = new List<string>();
                Hashtable blackList2 = redistList.GenerateBlackList(new AssemblyTableInfo[] { subsetListInfo }, whiteListErrors2, whiteListErrorFileNames2);
                Assert.Same(blackList, blackList2);
            }
            finally
            {
                File.Delete(redistFile);
                File.Delete(goodSubsetFile);
            }
        }
        internal static string ReadFile(AssemblyTableInfo assemblyTableInfo, List <AssemblyEntry> assembliesList, ArrayList errorsList, ArrayList errorFilenamesList)
        {
            string        path       = assemblyTableInfo.Path;
            string        redistName = null;
            XmlTextReader reader     = null;
            Dictionary <string, AssemblyEntry> dictionary = new Dictionary <string, AssemblyEntry>(StringComparer.OrdinalIgnoreCase);

            try
            {
                reader = new XmlTextReader(path);
                bool flag = false;
                while (reader.Read())
                {
                    if ((reader.NodeType != XmlNodeType.Element) || !string.Equals(reader.Name, "FileList", StringComparison.OrdinalIgnoreCase))
                    {
                        continue;
                    }
                    flag = true;
                    reader.MoveToFirstAttribute();
                    do
                    {
                        if (string.Equals(reader.Name, "Redist", StringComparison.OrdinalIgnoreCase))
                        {
                            redistName = reader.Value;
                            break;
                        }
                    }while (reader.MoveToNextAttribute());
                    reader.MoveToElement();
                    break;
                }
                if (flag)
                {
                    flag = false;
                    while (reader.Read())
                    {
                        if ((reader.NodeType == XmlNodeType.Element) && string.Equals(reader.Name, "File", StringComparison.OrdinalIgnoreCase))
                        {
                            string str3;
                            string str4;
                            string str5;
                            string str6;
                            string str7;
                            string str8;
                            bool   flag2;
                            bool   flag3;
                            flag = true;
                            Dictionary <string, string> dictionary2 = new Dictionary <string, string>(StringComparer.OrdinalIgnoreCase);
                            reader.MoveToFirstAttribute();
                            do
                            {
                                dictionary2.Add(reader.Name, reader.Value);
                            }while (reader.MoveToNextAttribute());
                            dictionary2.TryGetValue("AssemblyName", out str3);
                            dictionary2.TryGetValue("Version", out str4);
                            dictionary2.TryGetValue("PublicKeyToken", out str5);
                            dictionary2.TryGetValue("Culture", out str6);
                            dictionary2.TryGetValue("InGAC", out str7);
                            dictionary2.TryGetValue("IsRedistRoot", out str8);
                            if (!bool.TryParse(str7, out flag2))
                            {
                                flag2 = true;
                            }
                            bool?isRedistRoot = null;
                            if (bool.TryParse(str8, out flag3))
                            {
                                isRedistRoot = new bool?(flag3);
                            }
                            if (((!string.IsNullOrEmpty(str3) && !string.IsNullOrEmpty(str4)) && !string.IsNullOrEmpty(str5)) && !string.IsNullOrEmpty(str6))
                            {
                                AssemblyEntry entry  = new AssemblyEntry(str3, str4, str5, str6, flag2, isRedistRoot, redistName, assemblyTableInfo.FrameworkDirectory);
                                string        key    = string.Format(CultureInfo.InvariantCulture, "{0},{1}", new object[] { entry.FullName, !entry.IsRedistRoot.HasValue ? "null" : entry.IsRedistRoot.ToString() });
                                AssemblyEntry entry2 = null;
                                dictionary.TryGetValue(key, out entry2);
                                if ((entry2 == null) || ((entry2 != null) && entry.InGAC))
                                {
                                    dictionary[key] = entry;
                                }
                            }
                            reader.MoveToElement();
                        }
                    }
                }
            }
            catch (XmlException exception)
            {
                errorsList.Add(exception);
                errorFilenamesList.Add(path);
            }
            catch (Exception exception2)
            {
                if (Microsoft.Build.Shared.ExceptionHandling.NotExpectedException(exception2))
                {
                    throw;
                }
                errorsList.Add(exception2);
                errorFilenamesList.Add(path);
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }
            }
            foreach (AssemblyEntry entry3 in dictionary.Values)
            {
                assembliesList.Add(entry3);
            }
            return(redistName);
        }
        public int CompareTo(object obj)
        {
            AssemblyTableInfo info = (AssemblyTableInfo)obj;

            return(string.Compare(this.Descriptor, info.Descriptor, StringComparison.OrdinalIgnoreCase));
        }