We have a huge Visual Studio solution with many projects (SDK style). In order to simplify the update/maintenance we introduced the central package management feature with a Directory.Packages.props file including:
<PropertyGroup>
<CentralPackageTransitivePinningEnabled>true</CentralPackageTransitivePinningEnabled>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>
and all our references like:
<ItemGroup>
<PackageVersion Include="Microsoft.Build.Tasks.Git" Version="1.1.1" />
<PackageVersion Include="NUnit" Version="3.13.3" />
...
</ItemGroup>
So transitive pinning is currently enabled. The output of the projects in the solution will end up in one dedicated folder (the same folder for all our projects).
Now we have the following problem with the transitive package version handling. As example
PROJ1 -> Nuget Package "A" (Version 1.0) -> Nuget Package "B" (Version 2.0)
PROJ2 -> Nuget Package "X" (Version 1.0) -> Nuget Package "B" (Version 2.1)
PROJ3 -> Nuget Package "K" (Version 1.0) -> Nuget Package "B" (Version 2.0)
PROJ4 -> Nuget Package "E" (Version 1.0) -> Nuget Package "U" (Version 7.0)
So as you can see the PROJ2 has a transitive dependency to Package "B" in Version 2.1 and some other projects have a transitive dependency to Package "B" in Version 2.0.
How can we enforce that the highest version of the Package "B" is used for all projects? During build we can see that the output sometimes contains the version 2.0 and sometimes the version 2.1.
I already tried to add a nuget.config file to the solution with the following content:
<config>
<add key="dependencyVersion" value="Highest" />
</config>
But this doesn't work either.