You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Remove duplicates From the TargetFrameworks while doing restore. #32205
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
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
If I remember is correctly, it was because these .Distinct only removes identical items and these items would have different originalSpec metadata(with the OSGroup). but I can verify again as well.
I believe Viktor made a fix for this but you need to make sure you have the latest VS preview and SDK. I know @safern hit this too and was able to get past it with an update.
This happens inside VS because NuGet reads from TargetFramework and TargetFrameworks properties which they shouldn't: NuGet/Home#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.
This is still reproducing today and I tried to restore up front outside of VS and it doesn't workaround it. @Anipik@ViktorHofer can you have a look and see why our previous workarounds are broken?
As an update, the issue has been largely mitigated but will remain for any projects that multi-targets on netcoreapp2.x, netcoreapp3.x, netstandard or netframework.
Activity
ViktorHofer commentedon Feb 13, 2020
@Anipik why is the Distinct operation not working which runs before Restore? https://github.com/dotnet/arcade/blob/f50767f96246063f33a6565d318f3adf9058bace/src/Microsoft.DotNet.Build.Tasks.TargetFramework.Sdk/src/build/Microsoft.DotNet.Build.Tasks.TargetFramework.Sdk.targets#L55
Anipik commentedon Feb 13, 2020
If I remember is correctly, it was because these .Distinct only removes identical items and these items would have different originalSpec metadata(with the OSGroup). but I can verify again as well.
Anipik commentedon Feb 13, 2020
you are right, its getting removed. I will debug the reason behind the failure
ViktorHofer commentedon Feb 13, 2020
So the distinct operation actually works but there is another failure during restore?
Anipik commentedon Feb 13, 2020
yes it seems that way. i checked the binlog and duplicates are getting removed.
Anipik commentedon Feb 13, 2020
It fails only in the VS, restore is successful from the command line.
ericstj commentedon Feb 24, 2020
Is this still happening?
alexvy86 commentedon Apr 9, 2020
It is still happening, I just ran into it. I see it when opening and trying to build
System.Memoryin VS.ericstj commentedon Apr 9, 2020
I believe Viktor made a fix for this but you need to make sure you have the latest VS preview and SDK. I know @safern hit this too and was able to get past it with an update.
safern commentedon Apr 9, 2020
I tried to update but actually didn't go passed it, I mentioned it to @Anipik in the morning.
2 remaining items
shoter commentedon Jun 12, 2020
I also had the same problem with System.IO.FileSystem
Visual Studio Version 16.5.4
.NET SDK - 5.0.100-preview.6.20311.12
After updating VS to 16.6.2 the behavior remains the same. More solutions are affected with this problem.
ViktorHofer commentedon Jun 12, 2020
This happens inside VS because NuGet reads from
TargetFrameworkandTargetFrameworksproperties which they shouldn't: NuGet/Home#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
ericstj commentedon Sep 22, 2020
This is still reproducing today and I tried to restore up front outside of VS and it doesn't workaround it. @Anipik @ViktorHofer can you have a look and see why our previous workarounds are broken?
ViktorHofer commentedon Sep 26, 2020
@ericstj I shared workaround in #20411 (comment).
ViktorHofer commentedon Nov 15, 2020
As an update, the issue has been largely mitigated but will remain for any projects that multi-targets on netcoreapp2.x, netcoreapp3.x, netstandard or netframework.
eerhardt commentedon Nov 20, 2020
Does that mean all
Microsoft.Extensionsprojects will still have this issue?Anipik commentedon Nov 21, 2020
only if they target netcoreapp2.x-Platform, only netcoreapp2.x should be fine.
ericstj commentedon Nov 23, 2020
Yeah, none of extensions should be impacted. Runtime targeting isn't something that should be super prevalent.