Как мне получить NuGetFramework, представляющий текущую структуру?C#

Место общения программистов C#
Anonymous
Как мне получить NuGetFramework, представляющий текущую структуру?

Сообщение Anonymous »


I am trying to parse a nuget file to find which lib subfolder I should use to bring the referenced dlls in a project.

My approach is to find all instances which are compatible with the currently running framework.

While below compiles and runs the possible list is never filled. I think this is because the current instance isn't correct, as it has the version 0.0.0.0.

This means the comparer doesn't work.

So how do I get a NuGetFramework for the current framework?
using var packageReader = new PackageArchiveReader(packageStream); var current = new NuGetFramework(RuntimeInformation.FrameworkDescription); foreach (var i in packageReader.GetSupportedFrameworks()) { if (DefaultCompatibilityProvider.Instance.IsCompatible(i, current)) { possible.Add(i); } }

Источник: https://stackoverflow.com/questions/780 ... -framework

Вернуться в «C#»