Add support for exact version NuGet dependencies #769
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Context: #764
Today,
binderator
enforces "exact dependencies" specified in POM files. If you do not fulfill them you get this error:However, when we create NuGets we ignore this requirement and instead allow a "greater than or equal to" dependency. When types move from one package to another and the package versions are not kept locked, it can result in errors like
Type androidx.lifecycle.DispatchQueue is defined multiple times
. (#764)A wrinkle is that we use
<ProjectReference>
to create our dependency tree and it does not currently support specifying an "exact" version dependency. NuGet/Home#5556A workaround is to use a custom target in
Directory.Build.targets
that allows aExactVersion="true"
attribute to be added to a<ProjectReference>
. This attribute is then taken into account when NuGetpack
is run.This should help mitigate future errors caused by types moving between Java packages that should always have synced versions.