-
Notifications
You must be signed in to change notification settings - Fork 255
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
According to DefaultCompatibilityProvider, net5.0-windows packages are not compatible with net5.0-windows projects #10897
Comments
When you specify So when NuGet reads the relevant properties, For NuGet at restore/pack time, a target platform version is requires (such as 7.0), so NuGet really is comparing the compat between
https://github.com/dotnet/designs/blob/main/accepted/2020/net5/net5.md |
Yes, I can see how the code currently works, and it makes sense that The problem is that there isn't a consistent default platform version. I couldn't find any official documentation that said the default platform version of the windows platform should be 7.0, other than the linked github issue. The closest I could find was for runtime identifiers. If var compatibilityProvider = new CompatibilityProvider(
new FrameworkNameProvider(new[] { DefaultFrameworkMappings.Instance, new CustomFrameworkMappings() },
new[] { DefaultPortableFrameworkMappings.Instance }));
class CustomFrameworkMappings : IFrameworkMappings
{
public IEnumerable<KeyValuePair<NuGetFramework, NuGetFramework>> EquivalentFrameworks =>
new Dictionary<NuGetFramework, NuGetFramework> { { NuGetFramework.Parse("net5.0-windows"), NuGetFramework.Parse("net5.0-windows7.0") } };
// other properties omitted - Enumerable.Empty<T> for all of them works.
} but this approach has to add a new entry for every combination e.g. net6.0 would have to be added separately. It also doesn't work for checking whether If the default platform version for windows when omitted is always 7.0, then I can replace the empty platform version with 7.0 private static NuGetFramework AddDefaultPlatformVersion(NuGetFramework framework)
{
if (framework.Platform == "windows" && framework.PlatformVersion == FrameworkConstants.EmptyVersion)
{
return new NuGetFramework(framework.Framework, framework.Version, framework.Platform, new Version(7, 0));
}
return framework;
} But if |
Details about Problem
NuGet product used (NuGet.exe | Visual Studio | MSBuild.exe | dotnet.exe):
NuGet.Protocol package.
Product version:
5.9.1
Repro steps and/or sample project
Create a
net5.0-windows
project and pack it into a NuGet package, then consume it from anothernet5.0-windows
project.The package is generated as
net5.0-windows7.0
use
DefaultCompatibilityProvider
to check whether the package is compatible with thenet5.0-windows
target framework:Expected output:
true
Actual output:
false
The text was updated successfully, but these errors were encountered: