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.

[BUG] Azure sdk references packages that live in the .NET 6+ ref and runtime packs.

See original GitHub issue

Library name and version

Azure.Core 1.24.0

Describe the bug

The package references packages that are outdated and are a part of the ref and runtime packs for .NET 6+. As such I think they can be removed for those who target .NET 6 or newer TFMs. It also gets annoying when they get copied to our output directories as well. Azure.Identity is an dependency of SqlClient which is an dependency of efcore that is used on my projects.

Why remove the packages highlighted below? Well they could be/are outdated, also they use an unneeded amount of network usage to download them (replacing them with the copies from the ref packs for building should reduce network usage for metered networks, yes some programmers use metered networks).

What can be removed:

  • Azure.Core:
    • image (Microsoft.Bcl.AsyncInterfaces would have been nice to be able to remove or update to latest version)
  • Azure.Identity:
    • image (protecteddata can be removed as msal references it, if it’s not 5.0.0+ then the package there should be updated to latest version)

With this cleanup it would make applications using efcore being able to have smaller build output directories which would make the typical dev using efcore more happy 😄. Also keep up the good work on the azure sdk.

Expected behavior

For these packages to not be in the reference to Azure.Identity and Azure.Core (or the entire SDK even) as they are either could be/are outdated (the ref packs are a much better way to get the references at least for .NET 6+) to also reduce the amount of files copied to the consumer’s build output directories (for those who do FDD deployments and not SCD deployments).

Actual behavior

The packages highlighted above are referenced needlessly which then gets copied into consumer project’s build output directories when they are not self contained.

Reproduction Steps

Create a new project that references EFCore for sql server and make an db context to an test database, then build the program and look at it’s build output directory (do not deploy as self contained).

Environment

.NET SDK:
 Version:   7.0.100-preview.5.22227.1
 Commit:    ebd9c5c2b2

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.22000
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\7.0.100-preview.5.22227.1\

global.json file:
  Not found

Host:
  Version:      7.0.0-preview.5.22225.6
  Architecture: x64
  Commit:       6387a2dc3d

.NET SDKs installed:
  3.1.418 [C:\Program Files\dotnet\sdk] (Visual Studio installed this because I also been working on the winforms repo...)
  5.0.407 [C:\Program Files\dotnet\sdk] (Visual Studio installed this because I also been working on the winforms repo...)
  6.0.104 [C:\Program Files\dotnet\sdk] (I installed this)
  6.0.202 [C:\Program Files\dotnet\sdk] (I installed this)
  6.0.300-preview.22204.3 [C:\Program Files\dotnet\sdk] (Visual Studio installed this as well)
  7.0.100-preview.5.22227.1 [C:\Program Files\dotnet\sdk] (I installed this)

.NET runtimes installed:
  Elskom.Sdk.App 6.0.0-preview.58.1 [C:\Program Files\dotnet\shared\Elskom.Sdk.App] (an runtime I made myself)
  Microsoft.AspNetCore.App 3.1.24 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.16 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 7.0.0-preview.5.22226.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 3.1.24 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.16 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 7.0.0-preview.5.22225.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 3.1.24 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 5.0.16 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 6.0.4 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 7.0.0-preview.5.22226.2 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Download .NET:
  https://aka.ms/dotnet-download

Learn about .NET Runtimes and SDKs:
  https://aka.ms/dotnet/runtimes-sdk-info

Visual Studio 2022 17.2 Preview 5.

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:2
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
ericstjcommented, May 2, 2022

cc @viktorhofer

I do think it’s good to target newer frameworks and reduce your dependency set. For any packages which have been absorbed into the framework this is safe and compatible. You can also benefit by using the new API and functionality available in those new frameworks.

PS: The only place to be careful about this is with packages like Microsoft.BCL.AsyncInterfaces – those were not absorbed by the framework and need to remain exposed – or even better if you ever use them try to avoid exposing them by using PrivateAssets="Compile"

0reactions
AraHaancommented, Jul 31, 2023

This is still work in progress due to the PR having some conflicts.

Read more comments on GitHub >

github_iconTop Results From Across the Web

PackageReference in project files - NuGet
Package references, using <PackageReference> MSBuild items, specify NuGet package dependencies directly within project files, as opposed to ...
Read more >
AzurePipeline failing due to: The reference assemblies for . ...
AzurePipeline failing due to: The reference assemblies for . ... To resolve this, install the Developer Pack (SDK/Targeting Pack) for this ...
Read more >
The reference assemblies for framework ".NETFramework ...
I've tried installing the .NET Framework 4.6.2 SDK, as well as the 4.6 Targeting Pack, however both error that I already have it...
Read more >
Active questions tagged nuget-package - Stack Overflow ...
When I inspect the nuget packages, I can see that they reference the common package. Is there a way that I can get...
Read more >
Azure.Core 1.34.0
Azure Core shared client library for .NET. Azure.Core provides shared primitives, abstractions, and helpers for modern .NET Azure SDK client libraries.
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