Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

[Build] Centrally manage NuGet package versions #4180

Closed
Nirmal4G opened this issue Aug 15, 2021 · 1 comment · May be fixed by #4181 or CommunityToolkit/dotnet#96
Closed

[Build] Centrally manage NuGet package versions #4180

Nirmal4G opened this issue Aug 15, 2021 · 1 comment · May be fixed by #4181 or CommunityToolkit/dotnet#96
Labels
feature request 📬 A request for new changes to improve functionality In-PR 🚀

Comments

@Nirmal4G
Copy link
Contributor

Nirmal4G commented Aug 15, 2021

Describe the problem this feature would solve

NuGet package references are spread across project files. It is difficult to track versions and upgrade them properly. It would be simple and easier to manage the versions and the packages centrally, if there were a way to store versions, separately in a central location, away from the project files. In the future, you could also separate testing versions from shipping versions and use them in CI build intelligently. But this would require re-organizing the project's folder structure. If this works, I'll open a proposal to re-organize the projects to effectively use modern build features that are at our disposal.

Describe the solution

Use NuGet's upcoming feature to manage package versions centrally using Directory.Packages.props with the following item spec to store a package version.

  <ItemGroup>
    <PackageVersion Include="Vendor.Awesome.Package" Version="11.0.0" />
  </ItemGroup>

Then, all you need to remove the version tag/attribute from all the project files, like so...

  <ItemGroup>
-    <PackageReference Include="Vendor.Awesome.Package" Version="11.0.0" />
+    <PackageReference Include="Vendor.Awesome.Package" />
  </ItemGroup>

  <ItemGroup>
-    <PackageReference Include="Vendor.Awesome.Package">
-      <Version>11.0.0</Version>
-    </PackageReference>
+    <PackageReference Include="Vendor.Awesome.Package" />
  </ItemGroup>

Describe alternatives you've considered

There is a Microsoft.Build.CentralPackageVersions, an MSBuild SDK which is a part of MSBuild SDKs maintained by @jeffkl. But for simple scenarios like ours, I've decided to go with the built-in support from NuGet's feature. It enables us to dogfood the feature and give feedback to the NuGet team.

Additional context & Screenshots

Know more about NuGet's Central Package Version Management (CPVM) feature.

@Nirmal4G Nirmal4G added the feature request 📬 A request for new changes to improve functionality label Aug 15, 2021
@ghost
Copy link

ghost commented Aug 15, 2021

Hello, 'Nirmal4G! Thanks for submitting a new feature request. I've automatically added a vote 👍 reaction to help get things started. Other community members can vote to help us prioritize this feature in the future!

@ghost ghost added the In-PR 🚀 label Aug 15, 2021
@CommunityToolkit CommunityToolkit locked and limited conversation to collaborators Jul 29, 2022
@LalithaNadimpalli LalithaNadimpalli converted this issue into discussion #4691 Jul 29, 2022

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
feature request 📬 A request for new changes to improve functionality In-PR 🚀
Projects
None yet
1 participant