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

[Feature]: Centralized package management update package version property when passed as parameter. #12156

Open
asimeonov opened this issue Oct 13, 2022 · 4 comments

Comments

@asimeonov
Copy link

asimeonov commented Oct 13, 2022

NuGet Product(s) Involved

NuGet.exe

The Elevator Pitch

When Directory.Packages.props is used for centralized management we can use PropertyGroup defined variable for package version. Can updating one of the packages that are under this version change the version in PropertyGroup not replacing the version. I know that this may lead to mistakes but it will be more convent when updating internal feeds with packages that should be synchronized to fixed versions.

Sample Directory.Packages.props:

<Project>
  <PropertyGroup>
    <EfCoreVersion>6.0.3</EfCoreVersion>
    <ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
  </PropertyGroup>
  <ItemGroup>
    <PackageVersion Include="Microsoft.EntityFrameworkCore" Version="$(EfCoreVersion)" />
    <PackageVersion Include="Microsoft.EntityFrameworkCore.SqlServer" Version="$(EfCoreVersion)" />
    <PackageVersion Include="Microsoft.EntityFrameworkCore.Design" Version="$(EfCoreVersion)" />
    <PackageVersion Include="Microsoft.EntityFrameworkCore.InMemory" Version="$(EfCoreVersion)" />
  </ItemGroup>
</Project>

Additional Context and Details

No response

@nkolev92
Copy link
Member

cc @jeffkl Do we have any duplicates for this?

Is this even feasible? I know this can be very complicated to do.

@jeffkl
Copy link
Contributor

jeffkl commented Oct 17, 2022

This works today just fine, you just have to declare the properties at the top of Directory.Packages.props or an import before that. For example, Directory.Packages.props is imported before the project's contents so you can't declare these properties in a project. You can set the property and do a <PackageVersion Update="" /> in the project if needed.

The example above should work just fine.

@nkolev92
Copy link
Member

The question is more about whether the tooling such as dotnet add package or VS Package Manager installation can update the property instead of the item attribute.

@jeffkl
Copy link
Contributor

jeffkl commented Oct 19, 2022

The question is more about whether the tooling such as dotnet add package or VS Package Manager installation can update the property instead of the item attribute.

Ah thanks, I'll leave this open for tracking.

@tmeschter do you have any rough estimate how much work it would be for project system to determine that a <PackageVersion /> Version attribute is being set by a property and update that property value instead?

@nkolev92 nkolev92 changed the title [Feature]: Centralized package management update package version when passed as parameter. [Feature]: Centralized package management update package version property when passed as parameter. Oct 24, 2022
@nkolev92 nkolev92 added the Priority:2 Issues for the current backlog. label Oct 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants