public string GetAssemblyFullName(string assemblyName, TargetFramework fx)
        {
            Initialize();

            assemblyName = NormalizeAsmName(assemblyName);

            // Fast path for known assemblies.
            if (assemblyFullNameToAsm.ContainsKey(assemblyName))
            {
                return(assemblyName);
            }

            // Look in assemblies of the framework. Done here since later steps look in the gac
            // without taking into account the framework.
            foreach (SystemAssembly sa in GetAssemblies(fx))
            {
                if (sa.Package.IsGacPackage && sa.Name == assemblyName)
                {
                    return(sa.FullName);
                }
            }

            if (File.Exists(assemblyName))
            {
                return(SystemAssemblyService.GetAssemblyName(assemblyName));
            }

            string file = GetAssemblyLocation(assemblyName, fx);

            if (file != null)
            {
                return(SystemAssemblyService.GetAssemblyName(file));
            }
            else
            {
                return(null);
            }
        }
Exemple #2
0
 internal static SystemAssembly FromFile(string file)
 {
     return(new SystemAssembly(file, SystemAssemblyService.GetAssemblyName(file)));
 }