Ejemplo n.º 1
0
        string GetAssemblyPath(string assemblyName)
        {
            var parsed = SystemAssemblyService.ParseAssemblyName(assemblyName);

            if (string.IsNullOrEmpty(parsed.Name))
            {
                return(null);
            }

            string localName = Path.Combine(Path.Combine(BaseDirectory, "bin"), parsed.Name + ".dll");

            if (File.Exists(localName))
            {
                return(localName);
            }

            assemblyName = AssemblyContext.GetAssemblyFullName(assemblyName, TargetFramework);
            if (assemblyName == null)
            {
                return(null);
            }
            assemblyName = AssemblyContext.GetAssemblyNameForVersion(assemblyName, TargetFramework);
            if (assemblyName == null)
            {
                return(null);
            }
            return(AssemblyContext.GetAssemblyLocation(assemblyName, TargetFramework));
        }