dotnet / dotnet/aspnetcore

Nuget package injects global usings

Open
#59,209 7 comments 0 reactions 0 assignees View on GitHub
area-networking
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 10h
Merged PRs (30d)
281

Description

### Is there an existing issue for this?

- [x] I have searched the existing issues

### Describe the bug

Nuget package (https://www.nuget.org/packages/Telegram.Bot 22.1.3) adds dependency :

``

then after upgrade the following code stops compiling:

```csharp
using Google.Apis.Http;

namespace Gmail.Services;

internal interface IGoogleHttpClientFactory : IHttpClientFactory // Ambiguous reference: IHttpClientFactory
{
}
```

Is there any way to disable transitive global usings (https://github.com/dotnet/aspnetcore/issues/32451)?

### Expected Behavior

Expected no errors.

### Steps To Reproduce

_No response_

### Exceptions (if any)

_No response_

### .NET Version

_No response_

### Anything else?

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the conflict with Telegram.Bot 22.1.3 and the shown IGoogleHttpClientFactory declaration using Google.Apis.Http. Inspect the package's Microsoft.AspNetCore.App FrameworkReference and compare the behavior with the related aspnetcore issue on transitive global usings. Done means the dependency no longer introduces the ambiguous IHttpClientFactory error, or the supported way to disable it is clearly established.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
build-system, developer-experience
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.