question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Paket causes build warnings by adding references to NETStandard.Library

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:46 (42 by maintainers)

github_iconTop GitHub Comments

4reactions
OnurGumuscommented, Sep 15, 2019

I am still seeing this.

3reactions
JohanLarssoncommented, Feb 4, 2019

This should still be open right?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Detected package downgrade warning (dotnet core, vs 2017)
Library from 2.0.3 to 2.0.2. Reference the package directly from the project to select a different version . Once I added the NETStandard....
Read more >
release-notes
REVERT: Paket caused build warnings by adding references to NETStandard.Library - https://github.com/fsprojects/Paket/issues/2852 ...
Read more >
Troubleshooting NuGet Package Restore in Visual Studio
This error occurs when you attempt to build a project that contains references to one or more NuGet packages, but those packages are...
Read more >
NET Standard
NET Standard allows a library to use more APIs but means it can only be used on more recent versions of .NET. Targeting...
Read more >
Using .NET Standard with Full Framework .NET - Rick Strahl
2 project and I got the following assembly hell: By adding a reference to a .NET Standard 2.0 package a huge number of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found