Repository navigation
Paket causes build warnings by adding references to NETStandard.Library #2852
Copy link
Copy link
Closed
Description
Description
When adding Paket to a project which either:
- targets .NET Standard exclusively, or
- multi-targets, and one of those targets is .NET Standard,
the project immediately gets two build warnings. In a strict environment, this fails the build.
Repro steps
Please provide the steps required to reproduce the problem
- Clone https://github.com/yaakov-h/PaketTargetFrameworkRepro
- Run
dotnet restore - Optionally, also run
dotnet build.
Expected behavior
The build completes with zero warnings and zero errors.dotnet
Actual behavior
C:\Temp\PaketTargetFrameworkRepro>dotnet restore && dotnet build
C:\Program Files\dotnet\sdk\2.0.2\Sdks\Microsoft.NET.Sdk\build\Microsoft.NET.Sdk.DefaultItems.targets(199,5): warning : A PackageReference for 'NETStandard.Library' was included in your project. This package is implicitly referenced by the .NET SDK and you do not typically need to reference it from your project. For more information, see https://aka.ms/sdkimplicitrefs [C:\Temp\PaketTargetFrameworkRepro\PaketTargetFrameworkRepro\PaketTargetFrameworkRepro.csproj]
C:\Program Files\dotnet\sdk\2.0.2\Sdks\Microsoft.NET.Sdk\build\Microsoft.NET.Sdk.DefaultItems.targets(199,5): warning : A PackageReference for 'NETStandard.Library' was included in your project. This package is implicitly referenced by the .NET SDK and you do not typically need to reference it from your project. For more information, see https://aka.ms/sdkimplicitrefs [C:\Temp\PaketTargetFrameworkRepro\PaketTargetFrameworkRepro\PaketTargetFrameworkRepro.csproj]
Restore completed in 16.34 ms for C:\Temp\PaketTargetFrameworkRepro\PaketTargetFrameworkRepro\PaketTargetFrameworkRepro.csproj.
C:\Program Files\dotnet\sdk\2.0.2\Sdks\Microsoft.NET.Sdk\build\Microsoft.NET.Sdk.DefaultItems.targets(199,5): warning : A PackageReference for 'NETStandard.Library' was included in your project. This package is implicitly referenced by the .NET SDK and you do not typically need to reference it from your project. For more information, see https://aka.ms/sdkimplicitrefs [C:\Temp\PaketTargetFrameworkRepro\PaketTargetFrameworkRepro\PaketTargetFrameworkRepro.csproj]
C:\Program Files\dotnet\sdk\2.0.2\Sdks\Microsoft.NET.Sdk\build\Microsoft.NET.Sdk.DefaultItems.targets(199,5): warning : A PackageReference for 'NETStandard.Library' was included in your project. This package is implicitly referenced by the .NET SDK and you do not typically need to reference it from your project. For more information, see https://aka.ms/sdkimplicitrefs [C:\Temp\PaketTargetFrameworkRepro\PaketTargetFrameworkRepro\PaketTargetFrameworkRepro.csproj]
Microsoft (R) Build Engine version 15.4.8.50001 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.
PaketTargetFrameworkRepro -> C:\Temp\PaketTargetFrameworkRepro\PaketTargetFrameworkRepro\bin\Debug\netstandard1.3\PaketTargetFrameworkRepro.dll
Build succeeded.
0 Warning(s)
0 Error(s)
Time Elapsed 00:00:00.62
C:\Temp\PaketTargetFrameworkRepro>
Known workarounds
- Target
netand/ornetcoreappexplicitly instead ofnetstandard, or - Add
<DisableImplicitFrameworkReferences>true</DisableImplicitFrameworkReferences>to the project file.
Additional Information
.NET Command Line Tools (2.0.2)
Product Information:
Version: 2.0.2
Commit SHA-1 hash: a04b4bf512
Runtime Environment:
OS Name: Windows
OS Version: 10.0.15063
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\2.0.2\
Microsoft .NET Core Shared Framework Host
Version : 2.0.0
Build : e8b8861ac7faf042c87a5c2f9f2d04c98b69f28d
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Activity
[-]Paket causes build warnings by adding implicit references to NETStandard.Library[/-][+]Paket causes build warnings by adding references to NETStandard.Library[/+]forki commentedon Oct 18, 2017
Looks like this is .NET Command Line Tools (2.0.2) behaviour.
Will try to work around
forki commentedon Oct 18, 2017
BTW: you commited 8MB version of paket into the repro. Usually you want to commit the bootstrapper renamed as paket.exe. Then it's only couple of KB
yaakov-h commentedon Oct 18, 2017
Thanks!
And yeah, I know. Simple dirty repro... didn't know you could rename the bootstrapper though, thanks for the tip.
forki commentedon Oct 18, 2017
https://fsprojects.github.io/Paket/bootstrapper.html#Magic-mode for more details
forki commentedon Oct 18, 2017
mhm for some reason this breaks VS integration. reverting for now
forki commentedon Oct 18, 2017
looks it wasn't the issue for broken VS integration
yaakov-h commentedon Oct 18, 2017
Wrong bisect?
forki commentedon Oct 18, 2017
no I don't really know yet. It's VS isn't really stable and therefore it's all manual testing..
Revert "Revert "Do not reference NETStandard.Library directly - fixes #…
JohanLarsson commentedon Feb 4, 2019
This should still be open right?
forki commentedon Feb 4, 2019
I thought we fixed that in the targets file?
26 remaining items
forki commentedon Nov 21, 2019
@BlythMeister ?
BlythMeister commentedon Nov 21, 2019
Sorry didn't notice your message.
Good news, no errors & i can see the nowarn in my paket props file.
Bad news, warning still shows in visual studio 🤦♂
forki commentedon Nov 21, 2019
can you please remove the obj folder and delete the paket-files folder so that we test against freshly created obj?
forki commentedon Nov 21, 2019
didn't read that, So the nowarn did not help. can you please manually remove the condition from that property group?
BlythMeister commentedon Nov 21, 2019
adding
<DisableImplicitFrameworkReferences>true</DisableImplicitFrameworkReferences>to my project file manually cleared the warningfrom https://github.com/dotnet/cli/issues/5346#issuecomment-276029481
BlythMeister commentedon Nov 21, 2019
the no warn also shows in the project properties

So it's being seen by Visual Studio....just ignored.
BlythMeister commentedon Nov 21, 2019
manually updating paket.props file to have
stops the warning showing...
forki commentedon Nov 21, 2019
ok since it's only about designtime we can use that for now. In Paket 6 we will revisit how to deal with Implicit references. They are pretty bad from package management standpoint....
forki commentedon Nov 21, 2019
ok 5.236.5 is out now
BlythMeister commentedon Nov 21, 2019
Should the paket props version number be bumped?
forki commentedon Nov 21, 2019
BlythMeister commentedon Nov 21, 2019
@forki that fixes some....but broke others...so i don't think having that property is a good idea :(
My hunch....just reset this and leave the warning in Visual studio....it's not the end of the world...
forki commentedon Nov 21, 2019
ok let's close it with manual workaround in csproj for people that want to get rid of it:
we will revisit it soonish
BlythMeister commentedon Nov 21, 2019
sounds like a good idea to me :)
forki commentedon Nov 21, 2019
5.236.6 is on it's way and should restore original behaviour