Force PackageReference to target a specific TFM #13554
Labels
Functionality:Restore
Resolution:Duplicate
This issue appears to be a Duplicate of another issue
Style:PackageReference
Triage:Untriaged
Type:Feature
@zivkan Is there a way to force PackageReference to target a specific TFM? As an alternative (and improvement) to AssetTargetFallback.
I think there is a design flaw/bug in how nuget transitive restore works in the case of net48 projects that reference a package that targets netstandard2.0 that transitively references a package that targets both netstandard2.0 and net462.
In my case, System.Diagnostics.DiagnosticSource is a messy nuget package that claims to support net462, except .NET Framework 4.6.2 does not have the Logger field, so telemetry packages emit a ton of the same repeat message: "The parameters to the Event method do not match the parameters to the WriteEvent method. This may cause the event to be displayed incorrectly." I'd love to tell my ASP.NET Classic Website that targets net48 to fallback to netstandard2.0 for just this package.
The crux of the problem appears to be
GetReferenceNearestTargetFrameworkTask
assumes I want net462 rather than netstandard2.0, but I'm not certain!The following does not seem to work, because the first pass finds net462 (when almost everyone expects a net48 project to use netstandard2.0 if available):
The text was updated successfully, but these errors were encountered: