Skip to content

[release/6.0] Microsoft.DotNet.Build.Tasks.TargetFramework.Sdk fails to filter out duplicate TFM (and platform specific TFM) #11998

@ayakael

Description

@ayakael
  • This issue is blocking
  • This issue is causing unreasonable pain

Initially reported in dotnet/source-build#3176, build of runtime (tag v6.0.12) within source-build environement fails with the following error:

   Determining projects to restore...
    /builds/ayakael/aports/community/dotnet6-build/src/bootstrap/sdk/6.0.111/NuGet.RestoreEx.targets(19,5): error : Invalid restore input. Duplicate frameworks found: 'net6.0-windows7.0, net6.0, netstandard2.0, netstandard2.0, net461'. Input files: /builds/ayakael/aports/community/dotnet6-build/src/dotnet-v6.0.112/src/runtime/artifacts/source-build/self/src/src/libraries/Microsoft.Win32.Registry.AccessControl/src/Microsoft.Win32.Registry.AccessControl.csproj. [/builds/ayakael/aports/community/dotnet6-build/src/dotnet-v6.0.112/src/runtime/artifacts/source-build/self/src/Build.proj]
    /builds/ayakael/aports/community/dotnet6-build/src/bootstrap/sdk/6.0.111/NuGet.RestoreEx.targets(19,5): error :    at NuGet.Commands.SpecValidationUtility.ValidateFrameworks(PackageSpec spec, IEnumerable`1 files) [/builds/ayakael/aports/community/dotnet6-build/src/dotnet-v6.0.112/src/runtime/artifacts/source-build/self/src/Build.proj]
    /builds/ayakael/aports/community/dotnet6-build/src/bootstrap/sdk/6.0.111/NuGet.RestoreEx.targets(19,5): error :    at NuGet.Commands.SpecValidationUtility.ValidateProjectSpecPackageReference(PackageSpec spec, IEnumerable`1 files) [/builds/ayakael/aports/community/dotnet6-build/src/dotnet-v6.0.112/src/runtime/artifacts/source-build/self/src/Build.proj]
    /builds/ayakael/aports/community/dotnet6-build/src/bootstrap/sdk/6.0.111/NuGet.RestoreEx.targets(19,5): error :    at NuGet.Commands.SpecValidationUtility.ValidateProjectSpec(PackageSpec spec) [/builds/ayakael/aports/community/dotnet6-build/src/dotnet-v6.0.112/src/runtime/artifacts/source-build/self/src/Build.proj]
    /builds/ayakael/aports/community/dotnet6-build/src/bootstrap/sdk/6.0.111/NuGet.RestoreEx.targets(19,5): error :    at NuGet.Commands.SpecValidationUtility.ValidateDependencySpec(DependencyGraphSpec spec, HashSet`1 projectsToSkip) [/builds/ayakael/aports/community/dotnet6-build/src/dotnet-v6.0.112/src/runtime/artifacts/source-build/self/src/Build.proj]
    /builds/ayakael/aports/community/dotnet6-build/src/bootstrap/sdk/6.0.111/NuGet.RestoreEx.targets(19,5): error :    at NuGet.Commands.DependencyGraphSpecRequestProvider.GetRequestsFromItems(RestoreArgs restoreContext, DependencyGraphSpec dgFile) [/builds/ayakael/aports/community/dotnet6-build/src/dotnet-v6.0.112/src/runtime/artifacts/source-build/self/src/Build.proj]
    /builds/ayakael/aports/community/dotnet6-build/src/bootstrap/sdk/6.0.111/NuGet.RestoreEx.targets(19,5): error :    at NuGet.Commands.DependencyGraphSpecRequestProvider.CreateRequests(RestoreArgs restoreContext) [/builds/ayakael/aports/community/dotnet6-build/src/dotnet-v6.0.112/src/runtime/artifacts/source-build/self/src/Build.proj]
    /builds/ayakael/aports/community/dotnet6-build/src/bootstrap/sdk/6.0.111/NuGet.RestoreEx.targets(19,5): error :    at NuGet.Commands.RestoreRunner.CreatePreLoadedRequests(RestoreArgs restoreContext) [/builds/ayakael/aports/community/dotnet6-build/src/dotnet-v6.0.112/src/runtime/artifacts/source-build/self/src/Build.proj]
    /builds/ayakael/aports/community/dotnet6-build/src/bootstrap/sdk/6.0.111/NuGet.RestoreEx.targets(19,5): error :    at NuGet.Commands.RestoreRunner.GetRequests(RestoreArgs restoreContext) [/builds/ayakael/aports/community/dotnet6-build/src/dotnet-v6.0.112/src/runtime/artifacts/source-build/self/src/Build.proj]
    /builds/ayakael/aports/community/dotnet6-build/src/bootstrap/sdk/6.0.111/NuGet.RestoreEx.targets(19,5): error :    at NuGet.Commands.RestoreRunner.RunAsync(RestoreArgs restoreContext, CancellationToken token) [/builds/ayakael/aports/community/dotnet6-build/src/dotnet-v6.0.112/src/runtime/artifacts/source-build/self/src/Build.proj]
    /builds/ayakael/aports/community/dotnet6-build/src/bootstrap/sdk/6.0.111/NuGet.RestoreEx.targets(19,5): error :    at NuGet.Build.Tasks.BuildTasksUtility.RestoreAsync(DependencyGraphSpec dependencyGraphSpec, Boolean interactive, Boolean recursive, Boolean noCache, Boolean ignoreFailedSources, Boolean disableParallel, Boolean force, Boolean forceEvaluate, Boolean hideWarningsAndErrors, Boolean restorePC, Boolean cleanupAssetsForUnsupportedProjects, ILogger log, CancellationToken cancellationToken) [/builds/ayakael/aports/community/dotnet6-build/src/dotnet-v6.0.112/src/runtime/artifacts/source-build/self/src/Build.proj]
    /builds/ayakael/aports/community/dotnet6-build/src/bootstrap/sdk/6.0.111/NuGet.RestoreEx.targets(19,5): error :    at NuGet.Build.Tasks.Console.MSBuildStaticGraphRestore.RestoreAsync(String entryProjectFilePath, IDictionary`2 globalProperties, IReadOnlyDictionary`2 options) [/builds/ayakael/aports/community/dotnet6-build/src/dotnet-v6.0.112/src/runtime/artifacts/source-build/self/src/Build.proj]

Through trial and error, it was found that rolling back Microsoft.DotNet.Build.Tasks.TargetFramework.Sdk to 6.0.0-beta.22512 (commit bb1e72113a7eaf8bebda940beba8cf8bee1b453f) from 6.0.0-beta.22564.9 (commit 0967701e5527a1be21d9473821077c3f4be7f9dc) in runtime's global.json goes around the issue.

git diff release/6.0 bb1e72113a7eaf8bebda940beba8cf8bee1b453f doesn't yield any obvious culprits, thus it remains a mystery on why duplicate TFMs aren't filtered out.

After manually removing duplicate framework, it was also found that there was a failure to filter out platform-specific TFMs, which on source-build triggers error NU1012: Platform version is not present for one or more target frameworks, even though they have specified a platform.

Relevant binlog:
runtime.binlog.log

/cc: @crummel

Release Note Category

  • Feature changes/additions
  • Bug fixes
  • Internal Infrastructure Improvements

Release Note Description

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions