internal static ReferenceAssemblyType GetPathToReferenceAssembly(Assembly a, out string path, ICollection <BuildErrorEventArgs> errors, ICollection <BuildWarningEventArgs> warnings, bool checkDependencies)
        {
            lock (s_lock)
            {
                if (AssemblyLocations.TryGetValue(a, out path))
                {
                    return(ReferenceAssemblyTypes[a]);
                }
            }
            if ((TargetFrameworkReferenceAssemblyPaths == null) || (TargetFrameworkReferenceAssemblyPaths.Count == 0))
            {
                path = Util.GetAssemblyCodeBase(a);
                return(ReferenceAssemblyType.FrameworkAssembly);
            }
            AssemblyResolutionResult result = null;
            ReferenceAssemblyType    nonFrameworkAssembly = ReferenceAssemblyType.NonFrameworkAssembly;

            if (BuildResultCompiledAssemblyBase.AssemblyIsInCodegenDir(a))
            {
                path = Util.GetAssemblyCodeBase(a);
            }
            else
            {
                nonFrameworkAssembly = GetPathToReferenceAssembly(a, out path, errors, warnings, checkDependencies, true, out result);
            }
            StoreResults(a, path, result, nonFrameworkAssembly);
            return(nonFrameworkAssembly);
        }
        internal static ReferenceAssemblyType GetPathToReferenceAssembly(Assembly a, out string path,
                                                                         ICollection <BuildErrorEventArgs> errors, ICollection <BuildWarningEventArgs> warnings,
                                                                         bool checkDependencies)
        {
            lock (s_lock) {
                if (AssemblyLocations.TryGetValue(a, out path))
                {
                    return(ReferenceAssemblyTypes[a]);
                }
            }

            // If there are no reference assemblies available, just use the path to the loaded assembly.
            if (TargetFrameworkReferenceAssemblyPaths == null || TargetFrameworkReferenceAssemblyPaths.Count == 0)
            {
                path = System.Web.UI.Util.GetAssemblyCodeBase(a);
                return(ReferenceAssemblyType.FrameworkAssembly);
            }

            AssemblyResolutionResult result = null;
            ReferenceAssemblyType    referenceAssemblyType = ReferenceAssemblyType.NonFrameworkAssembly;

            // If the assembly is generated by us, it is a non framework assembly and does not need to be resolved.
            if (BuildResultCompiledAssemblyBase.AssemblyIsInCodegenDir(a))
            {
                path = System.Web.UI.Util.GetAssemblyCodeBase(a);
            }
            else
            {
                // Try using the assembly full name.
                referenceAssemblyType = GetPathToReferenceAssembly(a, out path, errors, warnings,
                                                                   checkDependencies, true /*useFullName*/, out result);
            }

            StoreResults(a, path, result, referenceAssemblyType);
            return(referenceAssemblyType);
        }