runtime: Remove duplicates From the TargetFrameworks while doing restore.

When we build a libraries project in VS, it tries to due a restore. In our new config system, we remove the oSGroup from tfms just before restore. So for projects with <TargetFrameworks>netcoreapp5.0-Windows_NT;netcoreapp5.0-Unix<TargetFrameworks> ends with just

<TargetFrameworks>netcoreapp5.0;netcoreapp5.0</TargetFrameworks>

which is not a valid input for restore task. It wont effect the build in VS, but we should fix it becuase it would show as an error on the output pane in the vs and it would be required for enabling the restore on ref and srcs

The error looks like this

Error occurred while restoring NuGet packages: Invalid restore input. Duplicate frameworks found: 'netcoreapp5.0, netcoreapp5.0'. Input files: C:\git\runtime\src\libraries\System.IO.FileSystem\tests\System.IO.FileSystem.Tests.csproj.

cc @ViktorHofer @ericstj @safern @danmosemsft

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 1
  • Comments: 19 (18 by maintainers)

Most upvoted comments

Does that mean all Microsoft.Extensions projects will still have this issue?

only if they target netcoreapp2.x-Platform, only netcoreapp2.x should be fine.

This happens inside VS because NuGet reads from TargetFramework and TargetFrameworks properties which they shouldn’t: https://github.com/NuGet/Home/issues/5154.

See my response in that issue for a more detailed explanation. You can workaround this until the issue is fixed by restoring the affected projected from CLI and/or by disabling NuGet restore inside VS.

cc @nkolev92 @zkat