using NuGet.Commands;
using NuGet.Frameworks;
using System.Collections.Generic;
class Program
{
static void Main()
{
AssetTargetFallbackUtility.GetFallbackFramework(NuGetFramework.AnyFramework,
new List<NuGetFramework>() { NuGetFramework.AnyFramework },
new List<NuGetFramework>() { NuGetFramework.AnyFramework });
}
}
throws:
System.MissingMethodException
HResult=0x80131513
Message=Method not found: 'Void NuGet.Frameworks.FallbackFramework..ctor(NuGet.Frameworks.NuGetFramework, System.Collections.Generic.IReadOnlyList`1<NuGet.Frameworks.NuGetFramework>)'.
Source=NuGet.Commands
StackTrace:
at NuGet.Commands.AssetTargetFallbackUtility.GetFallbackFramework(NuGetFramework projectFramework, IEnumerable`1 packageTargetFallback, IEnumerable`1 assetTargetFallback)
at Nuget5._11Issue.Program.Main() in ...\Program.cs:line 10
Context: I have encountered this problem while using Restore from Nuget.Commands after upgrading to version=5.11.0 from 5.8
Investigation: Nuget.Frameworks 5.11 targets .NETFramework 4.0, .NETFramework 4.7.2 and .NETStandard 2.0. A project that targets .NET461 will use the Nuget.Frameworks for .NETFramework 4.0 because it's the closest version. On .NETFramework 4.0 the reported missing method is indeed missing.
Nuget.Frameworks 5.8 targets also .NETFramework 4.5 which for a NET461 project would be the closest version and on this version the method is not missing.
NuGet Product Used
MSBuild.exe
Product Version
NuGet.Frameworks package 5.11.0
Worked before?
NuGet.Frameworks package 5.8.0
Impact
I'm unable to use this version
Repro Steps & Context
Repro Steps: .NETFramework4.6.1 Console Application:
throws:
Context: I have encountered this problem while using Restore from Nuget.Commands after upgrading to version=5.11.0 from 5.8
Investigation: Nuget.Frameworks 5.11 targets .NETFramework 4.0, .NETFramework 4.7.2 and .NETStandard 2.0. A project that targets .NET461 will use the Nuget.Frameworks for .NETFramework 4.0 because it's the closest version. On .NETFramework 4.0 the reported missing method is indeed missing. Nuget.Frameworks 5.8 targets also .NETFramework 4.5 which for a NET461 project would be the closest version and on this version the method is not missing.
Verbose Logs
No response