public string FindAssemblyFile(IAssemblyReference name)
        {
            if (name.IsWindowsRuntime)
            {
                return(FindWindowsMetadataFile(name));
            }

            string file = null;

            switch (targetFrameworkIdentifier)
            {
            case TargetFrameworkIdentifier.NETCoreApp:
            case TargetFrameworkIdentifier.NETStandard:
                if (IsZeroOrAllOnes(targetFrameworkVersion))
                {
                    goto default;
                }
                if (dotNetCorePathFinder == null)
                {
                    if (mainAssemblyFileName == null)
                    {
                        dotNetCorePathFinder = new DotNetCorePathFinder(targetFrameworkIdentifier, targetFrameworkVersion);
                    }
                    else
                    {
                        dotNetCorePathFinder = new DotNetCorePathFinder(mainAssemblyFileName, targetFramework, targetFrameworkIdentifier, targetFrameworkVersion);
                    }
                    foreach (var directory in directories)
                    {
                        dotNetCorePathFinder.AddSearchDirectory(directory);
                    }
                }
                file = dotNetCorePathFinder.TryResolveDotNetCore(name);
                if (file != null)
                {
                    return(file);
                }
                goto default;

            case TargetFrameworkIdentifier.Silverlight:
                if (IsZeroOrAllOnes(targetFrameworkVersion))
                {
                    goto default;
                }
                file = ResolveSilverlight(name, targetFrameworkVersion);
                if (file != null)
                {
                    return(file);
                }
                goto default;

            default:
                return(ResolveInternal(name));
            }
        }
        public string FindAssemblyFile(IAssemblyReference name)
        {
            var    targetFramework = TargetFramework.Split(new[] { ",Version=v" }, StringSplitOptions.None);
            string file            = null;

            switch (targetFramework[0])
            {
            case ".NETCoreApp":
            case ".NETStandard":
                if (targetFramework.Length != 2)
                {
                    goto default;
                }
                if (dotNetCorePathFinder == null)
                {
                    var version = targetFramework[1].Length == 3 ? targetFramework[1] + ".0" : targetFramework[1];
                    dotNetCorePathFinder = new DotNetCorePathFinder(mainAssemblyFileName, TargetFramework, version);
                }
                file = dotNetCorePathFinder.TryResolveDotNetCore(name);
                if (file != null)
                {
                    return(file);
                }
                goto default;

            case "Silverlight":
                if (targetFramework.Length != 2)
                {
                    goto default;
                }
                file = ResolveSilverlight(name, new Version(targetFramework[1]));
                if (file != null)
                {
                    return(file);
                }
                goto default;

            default:
                return(ResolveInternal(name));
            }
        }
        string FindClosestVersionDirectory(string basePath, Version version)
        {
            string path = null;

            foreach (var folder in new DirectoryInfo(basePath).GetDirectories().Select(d => DotNetCorePathFinder.ConvertToVersion(d.Name))
                     .Where(v => v.Item1 != null).OrderByDescending(v => v.Item1))
            {
                if (path == null || folder.Item1 >= version)
                {
                    path = folder.Item2;
                }
            }
            return(path ?? version.ToString());
        }