You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are doing old-school central management: <PackageReference Update="name" Version="version" /> in Directory.Build.targets.
We chose the targets file because it evaluated after the csproj, and enables conditional versioning.
E.g. <PackageReference Update="name" Version="version" Condition="'$(OurCustomFlag)' == 'true' OR '$(TargetFramework)' == 'net6.0'" />
We'd want to switch to modern-style central package management for the transitive pinning feature, but still have to keep our custom versioning conditions.
Central package management seems to work with PackageVersions in Directory.Build.targets too, but it is not the intended way, as we'd have to work around this check in NuGet.targets (not only you have to set ManagePackageVersionsCentrally, but also have to have a Directory.Packages.props file for the feature to work - note: it's not required from the latest VS but it is in the latest net8 sdk which I'm guessing is due to different versions of NuGet.targets)
I am thinking of going forward with the workaround: adding an empty Directory.Packages.props file.
But do you think there's significant risk this idea - managing PackageVersion items from Directory.Build.targets - might break in the future?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
We are doing old-school central management:
<PackageReference Update="name" Version="version" />
inDirectory.Build.targets
.We chose the targets file because it evaluated after the csproj, and enables conditional versioning.
E.g.
<PackageReference Update="name" Version="version" Condition="'$(OurCustomFlag)' == 'true' OR '$(TargetFramework)' == 'net6.0'" />
We'd want to switch to modern-style central package management for the transitive pinning feature, but still have to keep our custom versioning conditions.
Central package management seems to work with PackageVersions in
Directory.Build.targets
too, but it is not the intended way, as we'd have to work around this check in NuGet.targets (not only you have to setManagePackageVersionsCentrally
, but also have to have aDirectory.Packages.props
file for the feature to work - note: it's not required from the latest VS but it is in the latest net8 sdk which I'm guessing is due to different versions ofNuGet.targets
)I am thinking of going forward with the workaround: adding an empty
Directory.Packages.props
file.But do you think there's significant risk this idea - managing PackageVersion items from
Directory.Build.targets
- might break in the future?Beta Was this translation helpful? Give feedback.
All reactions