给定一个项目目标框架(比如net472)和一个包含大量支持目标框架的nuget包,我们可以使用什么NuGet API来匹配Nuget目标框架和项目目标框架?
例如,System.Diagnostics.DiagnosticSource的包中有5个目标框架:
当NuGet自己决定将这些框架中的任何一个与Nuget匹配时,我想要相同的net472 Api (我想它应该是net46)。
由于搜索中有大量的假阳性,很难找到任何文档。
编辑1
我想这是NuGet.Frameworks包。寻找合适的API ..。
发布于 2020-11-13 15:01:06
下面是我今天最后要做的事情:
public class FrameworkFromLibFolderPath : IFrameworkSpecific
{
public FrameworkFromLibFolderPath(string libFolderPath)
{
LibFolderPath = libFolderPath;
TargetFramework = NuGetFramework.ParseFolder(Path.GetFileName(libFolderPath));
}
public readonly string LibFolderPath;
public NuGetFramework TargetFramework { get; }
}和
var packageFrameworks = Directory
.EnumerateDirectories(baseLibFolderPath)
.Select(libFolderPath => new FrameworkFromLibFolderPath(libFolderPath))
.ToList();
var path = packageFrameworks.Count > 0 ? packageFrameworks.GetNearest(framework).LibFolderPath : baseLibFolderPath;https://stackoverflow.com/questions/64814565
复制相似问题