Skip to content
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

AutoGenerateBindingRedirects excludes transient dependencies #40803

Open
ArvindGundimajalu opened this issue May 10, 2024 · 2 comments
Open

AutoGenerateBindingRedirects excludes transient dependencies #40803

ArvindGundimajalu opened this issue May 10, 2024 · 2 comments
Assignees
Labels
Area-NetSDK untriaged Request triage from a team member

Comments

@ArvindGundimajalu
Copy link

Describe the bug

While trying to build the project using dotnet 6 cli and having the AutoGenerateBindingRedirects set to true, the assembly redirect config generated contains the redirects for the nugets that have been directly mentioned in the project but excludes the range for transient dependencies. This causes a problem when different 3rd party binaries are using different version of the transient binary.

To Reproduce

Create Project A that depends on version x of a 3rd party binary. Publish as Nuget
Create Project B that depends on version x+ of the same 3rd party binary. Publish as Nuget.

Create app C and consume nugets for A and B. C.config has assembly redirect for A and B but is missing 3rd party binary. Project fails to load B as its unable to find the x+ version of the 3rd party binary.

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-NetSDK untriaged Request triage from a team member labels May 10, 2024
@KalleOlaviNiemitalo
Copy link

KalleOlaviNiemitalo commented May 10, 2024

Do the NuGet packages for A and B include reference assemblies?
If so, do the reference assemblies depend on the third-party binary?

Project fails to load B as its unable to find the x+ version of the 3rd party binary.

That's surprising. I'd expect NuGet restore to choose the higher version x+ of the third-party binary, and B would then load OK, but A (which references the lower version x) would fail to load on .NET Framework without assembly redirects.

@ArvindGundimajalu
Copy link
Author

There are no reference assemblies other than System, System.Core. Irrespective of which version 3rd party is copied over the application fails to start as its entirely missing the assembly redirects in the app.config file. One thing that I forgot mentioning - I am using central package management for managing the packages across projects. So my question is why isn't dotnet with Central Package management resolving all the transient assemblies and enlisting them in the app.config? is this because CPM won't allow nuget version range? Is this being restricted by the rules governing cousin-dependencies?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-NetSDK untriaged Request triage from a team member
Projects
None yet
Development

No branches or pull requests

3 participants