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

CPM - Provide option to explicitly use version tags #12803

Open
DaleMckeown opened this issue Aug 9, 2023 · 1 comment
Open

CPM - Provide option to explicitly use version tags #12803

DaleMckeown opened this issue Aug 9, 2023 · 1 comment
Labels
Area:RestoreCPM Central package management Functionality:Restore Priority:3 Issues under consideration. With enough upvotes, will be reconsidered to be added to the backlog. Type:DCR Design Change Request

Comments

@DaleMckeown
Copy link

DaleMckeown commented Aug 9, 2023

NuGet Product(s) Affected

NuGet.exe, Visual Studio Package Management UI, Visual Studio Package Manager Console

Current Behavior

Currently, when CPM is used and new NuGet packages are added to a solution, the Version attribute is added to the PackageVersion in the Directory.Packages.props file.

<Project>
  <PropertyGroup>
    <ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
  </PropertyGroup>
  <ItemGroup>
    <PackageVersion Include="Microsoft.EntityFrameworkCore" Version="7.0.10" />
  </ItemGroup>
</Project>

When it comes to git usage, this causes issues when dependency updating tools such as Dependabot are used, because git uses the line before and after to detect changes. If consecutive packages are updated in the same Dependabot run, this will cause merge conflicts, which require manual intervention to fix.

Desired Behavior

The git conflicts are really easy to fix by explicitly using version tags in the package reference, like so:

<Project>
  <PropertyGroup>
    <ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
  </PropertyGroup>
  <ItemGroup>
    <PackageVersion Include="Microsoft.EntityFrameworkCore">
      <Version>7.0.10</Version>
    </PackageVersion>
  </ItemGroup>
</Project>

When adding new packages to a solution, we have to remember to manually amend the package references to this format. It would be better if we could specify a flag that would enforce NuGet to use the explicit version tags automatically, instead of using the inline attribute string.

A property such as UseExplicitPackageVersionTags could be used to enable this behaviour.

<Project>
  <PropertyGroup>
    <ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
    <UseExplicitPackageVersionTags>true</UseExplicitPackageVersionTags>
  </PropertyGroup>
  <ItemGroup>
    <PackageVersion Include="Microsoft.EntityFrameworkCore">
      <Version>7.0.10</Version>
    </PackageVersion>
  </ItemGroup>
</Project>

Additional Context

This would improve the developer experience for CPM users, where package update processes are in place.

@DaleMckeown DaleMckeown added Triage:Untriaged Type:DCR Design Change Request labels Aug 9, 2023
@donnie-msft donnie-msft added the Area:RestoreCPM Central package management label Aug 9, 2023
@donnie-msft
Copy link
Contributor

/cc @jeffkl

@donnie-msft donnie-msft added WaitingForClientTeam Customer replied, needs attention from client team. Do not apply this label manually. and removed Triage:Untriaged WaitingForClientTeam Customer replied, needs attention from client team. Do not apply this label manually. labels Aug 9, 2023
@nkolev92 nkolev92 added Functionality:Restore Priority:3 Issues under consideration. With enough upvotes, will be reconsidered to be added to the backlog. Pipeline:Icebox labels Aug 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area:RestoreCPM Central package management Functionality:Restore Priority:3 Issues under consideration. With enough upvotes, will be reconsidered to be added to the backlog. Type:DCR Design Change Request
Projects
None yet
Development

No branches or pull requests

4 participants