/// <summary>
        /// Check whether an assembly has dependencies to a framework assembly of a higher version,
        /// report the issue as a warning or error.
        /// </summary>
        private static void CheckOutOfRangeDependencies(string assemblyName)
        {
            string       dependencies = null;
            Assembly     assembly     = Assembly.Load(assemblyName);
            AssemblyName aName        = new AssemblyName(assemblyName);

            // If the loaded assembly has a different version than the specified assembly,
            // then it is likely that there was unification or binding redirect in place.
            // If that is the case, then GetReferenceAssemblies won't be accurate for
            // finding the references of the actual assembly, so we skip checking its references.
            if (assembly.GetName().Version != aName.Version)
            {
                return;
            }

            foreach (AssemblyName name in assembly.GetReferencedAssemblies())
            {
                try {
                    Assembly referenceAssembly = CompilationSection.LoadAndRecordAssembly(name);
                    string   path;
                    ReferenceAssemblyType referenceAssemblyType =
                        GetPathToReferenceAssembly(referenceAssembly, out path, null, null, false /*checkDependencies*/);

                    // We need to check the following 2 conditions:
                    // 1. If the assembly is available in the target framework, we also need to
                    // verify that the version being referenced is no higher than what we have
                    // in the target framework.
                    // 2. If the assembly is only available in a higher version framework.
                    Version resolvedAssemblyVersion = GetAssemblyVersion(path);
                    if (resolvedAssemblyVersion == null)
                    {
                        continue;
                    }

                    if ((referenceAssemblyType == ReferenceAssemblyType.FrameworkAssembly && resolvedAssemblyVersion < name.Version) ||
                        referenceAssemblyType == ReferenceAssemblyType.FrameworkAssemblyOnlyPresentInHigherVersion)
                    {
                        if (dependencies == null)
                        {
                            dependencies = name.FullName;
                        }
                        else
                        {
                            dependencies += "; " + name.FullName;
                        }
                    }
                }
                catch {
                    // Ignore dependencies that are not found, as we are primarily concerned
                    // with framework assemblies that are on the machine.
                }
            }

            if (dependencies != null)
            {
                string message = SR.GetString(SR.Higher_dependencies, assemblyName, dependencies);
                ReportWarningOrError(message);
            }
        }
        private static void CheckOutOfRangeDependencies(string assemblyName)
        {
            string       fullName = null;
            Assembly     assembly = Assembly.Load(assemblyName);
            AssemblyName name     = new AssemblyName(assemblyName);

            if (assembly.GetName().Version == name.Version)
            {
                foreach (AssemblyName name2 in assembly.GetReferencedAssemblies())
                {
                    try
                    {
                        string str2;
                        ReferenceAssemblyType type = GetPathToReferenceAssembly(CompilationSection.LoadAndRecordAssembly(name2), out str2, null, null, false);
                        Version assemblyVersion    = GetAssemblyVersion(str2);
                        if ((assemblyVersion != null) && (((type == ReferenceAssemblyType.FrameworkAssembly) && (assemblyVersion < name2.Version)) || (type == ReferenceAssemblyType.FrameworkAssemblyOnlyPresentInHigherVersion)))
                        {
                            if (fullName == null)
                            {
                                fullName = name2.FullName;
                            }
                            else
                            {
                                fullName = fullName + "; " + name2.FullName;
                            }
                        }
                    }
                    catch
                    {
                    }
                }
                if (fullName != null)
                {
                    ReportWarningOrError(System.Web.SR.GetString("Higher_dependencies", new object[] { assemblyName, fullName }));
                }
            }
        }