Paket causes build warnings by adding references to NETStandard.Library

Created on 18 Oct 2017  ·  46Comments  ·  Source: fsprojects/Paket

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

  1. Clone https://github.com/yaakov-h/PaketTargetFrameworkRepro
  2. Run dotnet restore
  3. 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

  1. Target net and/or netcoreapp explicitly instead of netstandard, or
  2. 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

Most helpful comment

I am still seeing this.

All 46 comments

Looks like this is .NET Command Line Tools (2.0.2) behaviour.
Will try to work around

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

Thanks!

And yeah, I know. Simple dirty repro... didn't know you could rename the bootstrapper though, thanks for the tip.

mhm for some reason this breaks VS integration. reverting for now

looks it wasn't the issue for broken VS integration

Wrong bisect?

no I don't really know yet. It's VS isn't really stable and therefore it's all manual testing..

This should still be open right?

I thought we fixed that in the targets file?

Maybe I'm doing it wrong but I think I always see the warning for netstandard projects.
Repro: https://github.com/DotNetAnalyzers/PropertyChangedAnalyzers

I experience this issue when I import NSubstitute to a netstandard2.0 project. I made a repro project here https://github.com/persn/TestPaketBug

I am still seeing this.

@forki i think this is still an issue.

I still get this warning on my projects.

I just tried the repro from @persn from July 21. Dotnet restore and dotnet build do not give me any warnings

I'll take a look at it tonight and see if it still happens

i think it's a visual studio warning...it doesn't show when i run on the cli.

Ok will check that as well. We actually do things a bit differently for
design time builds.

Chris Blyth notifications@github.com schrieb am Mi., 20. Nov. 2019, 12:30:

i think it's a visual studio warning...it doesn't show when i run on the
cli.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/fsprojects/Paket/issues/2852?email_source=notifications&email_token=AAAOANEQKTHM7AAHWYP7ARLQUUNXFA5CNFSM4D7URXH2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEERVMNI#issuecomment-555963957,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAAOANHD7FZKZV3TMR3YP43QUUNXFANCNFSM4D7URXHQ
.

should be fixed in 5.236.2

I don't think that was the desired fix...

53>F:\GIT\FifteenBelow.Brains\src\15below.Brains.Commands.Metrics.Tests\15below.Brains.Commands.Metrics.Tests.csproj : error NU1605: Detected package downgrade: System.AppContext from 4.3.0 to 4.1.0. Reference the package directly from the project to select a different version. 
53>F:\GIT\FifteenBelow.Brains\src\15below.Brains.Commands.Metrics.Tests\15below.Brains.Commands.Metrics.Tests.csproj : error NU1605:  15below.Brains.Commands.Metrics.Tests -> Castle.Core 4.4.0 -> NETStandard.Library 1.6.1 -> System.AppContext (>= 4.3.0) 
53>F:\GIT\FifteenBelow.Brains\src\15below.Brains.Commands.Metrics.Tests\15below.Brains.Commands.Metrics.Tests.csproj : error NU1605:  15below.Brains.Commands.Metrics.Tests -> System.AppContext (>= 4.1.0)

I get this now with restore failures.

I have strategy min set if that helps diagnose.

Not just that dependency tree,,,but lots of others.,

Only in vs? Not in console?

Chris Blyth notifications@github.com schrieb am Mi., 20. Nov. 2019, 17:48:

I don't think that was the desired fix...

53>F:\GIT\FifteenBelow.Brains\src\15below.Brains.Commands.Metrics.Tests\15below.Brains.Commands.Metrics.Tests.csproj : error NU1605: Detected package downgrade: System.AppContext from 4.3.0 to 4.1.0. Reference the package directly from the project to select a different version.
53>F:\GIT\FifteenBelow.Brains\src\15below.Brains.Commands.Metrics.Tests\15below.Brains.Commands.Metrics.Tests.csproj : error NU1605: 15below.Brains.Commands.Metrics.Tests -> Castle.Core 4.4.0 -> NETStandard.Library 1.6.1 -> System.AppContext (>= 4.3.0)
53>F:\GIT\FifteenBelow.Brains\src\15below.Brains.Commands.Metrics.Tests\15below.Brains.Commands.Metrics.Tests.csproj : error NU1605: 15below.Brains.Commands.Metrics.Tests -> System.AppContext (>= 4.1.0)

I get this now with restore failures.

I have strategy min set if that helps diagnose.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/fsprojects/Paket/issues/2852?email_source=notifications&email_token=AAAOANCCGMNZINJMYQS5IK3QUVS5TA5CNFSM4D7URXH2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEESVJIA#issuecomment-556094624,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAAOANFZOALFBPW4VSUZLO3QUVS5TANCNFSM4D7URXHQ
.

Yeah, dotnet restore seems to be ok

Adding version 5.236.1 to my paket.dependencies file and then git clean allowed a build in visual studio to work fine (though has the Warning NETSDK1023 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 warning)

I don't have any issues any more on my projects 👍

i wonder if it's the min strategy?

@forki any chance of a revert so i don't need to get my devs to put that pin into every paket dependencies file :(

I don't think this is related to min strategy at all. the only thing we do is no longer referencing .NET Standard lib directly in background builds. I assume this is now a problem with transitive deps of .NET standard lib. I can revert tomorrow morning.

I did not revert but unlisted the version.

ok reverted.

Silly github closed this issue on a revert 🤦‍♂

can you please retry?

@BlythMeister ?

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 🤦‍♂

can you please remove the obj folder and delete the paket-files folder so that we test against freshly created obj?

i can see the nowarn in my paket props file.

didn't read that, So the nowarn did not help. can you please manually remove the condition from that property group?

adding <DisableImplicitFrameworkReferences>true</DisableImplicitFrameworkReferences> to my project file manually cleared the warning

from https://github.com/dotnet/cli/issues/5346#issuecomment-276029481

the no warn also shows in the project properties
image
So it's being seen by Visual Studio....just ignored.

manually updating paket.props file to have

    <PropertyGroup Condition="($(DesignTimeBuild) == true)">
        <DisableImplicitFrameworkReferences>true</DisableImplicitFrameworkReferences>
    </PropertyGroup>

stops the warning showing...

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....

ok 5.236.5 is out now

Should the paket props version number be bumped?

In theory yes. But I don't think we need to force rebuild on everyone

Chris Blyth notifications@github.com schrieb am Do., 21. Nov. 2019, 15:55:

Should the paket props version number be bumped?


You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
https://github.com/fsprojects/Paket/issues/2852?email_source=notifications&email_token=AAAOANCGNSE6RLRE5ADYSYTQU2OPBA5CNFSM4D7URXH2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEE2PZCY#issuecomment-557120651,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAAOANDO4FGUSM7Y7FVWK6LQU2OPBANCNFSM4D7URXHQ
.

@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...

ok let's close it with manual workaround in csproj for people that want to get rid of it:

<PropertyGroup Condition="($(DesignTimeBuild) == true)">
    <DisableImplicitFrameworkReferences>true</DisableImplicitFrameworkReferences>
</PropertyGroup>

we will revisit it soonish

sounds like a good idea to me :)

5.236.6 is on it's way and should restore original behaviour

Was this page helpful?
0 / 5 - 0 ratings