-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Microsoft.Extensions.Http is not being copied #110213
Comments
Tagging subscribers to this area: @dotnet/area-infrastructure-libraries |
How are you referencing your dll?
If you are using ProjectReference or packaging nuget properly, the dependency will be transitive. |
Please share a repro. Nuget dependencies are transitive by default. |
@ViktorHofer here is a sample solution where the exception is thrown. Notice the class library is referenced as assembly, and not as a project. Also, the Microsoft.Extensions.Http nuget isn't referenced as transitive in the console app project. Even more, and probably related to this: |
It's not recommended, and will never work as intended. Assembly is a lower level concept than projects or packages, it's doesn't have information about packages. |
@santo998 as @huoyaoyuan mentioned, using |
Description
I have a DLL which uses Microsoft.Extensions.Http.
Then, I have a project which references my DLL.
When I run my project, it throws the exception:
System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Extensions.Http, Version=9.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.
File name: 'Microsoft.Extensions.Http, Version=9.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'
...
If I reference Microsoft.Extensions.Http nuget from my project, it doesn't.
But, I shouldn't have to, because it doesn't reference it directly.
I think making the nuget package being transitive or copying the Microsoft.Extensions.Http DLL in some way via nuget would resolve this, so that's why I'm creating this issue.
Reproduction Steps
Have a DLL which references Microsoft.Extensions.Http, implement some method which uses that nuget package and call that method from another project.
Expected behavior
The project runs
Actual behavior
Exception thrown
Regression?
No response
Known Workarounds
Including direct reference to the nuget package from the project
Configuration
I'm running .NET 8 and referencing Microsoft.Extensions.Http 9.0.0
Other information
No response
The text was updated successfully, but these errors were encountered: