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

For #4955 Implement Centralized Package Version Management for Solution #4956

Closed

Conversation

leigh-pointer
Copy link
Contributor

This PR introduces Centralized Package Version Management for the solution by utilizing the Directory.Packages.props file. This change ensures consistency in package versions across all projects in the solution, streamlining the package update process and reducing the risk of version conflicts.
Key Changes:

  1. Centralized Package Version Management: Introduced Directory.Packages.props file to manage NuGet package versions at the solution level.
  • All common NuGet package versions are now defined in this single file.
  • Packages will be shared across all projects, ensuring the same version is used across the solution.
  1. Simplified Package Updates: Now, package versions can be updated in one place, and all projects will automatically use the updated version when restoring packages.

  2. Reduced Manual Updates: Eliminated the need to manually update NuGet package versions in each project's .csproj file.

Benefits:

  • Consistency: Ensures that all projects within the solution use the same version of shared packages, preventing version mismatches and potential issues.
  • Efficiency: Makes it easier to update NuGet package versions by only modifying the version in the Directory.Packages.props file, rather than in each individual project file.
  • Scalability: Ideal for large solutions with multiple projects, as the package management is simplified and centralized.

This PR introduces Centralized Package Version Management for the solution by utilizing the Directory.Packages.props file. This change ensures consistency in package versions across all projects in the solution, streamlining the package update process and reducing the risk of version conflicts.
Restore the packages on build
@leigh-pointer leigh-pointer changed the title Implement Centralized Package Version Management for Solution #4955 For #4955 Implement Centralized Package Version Management for Solution Dec 29, 2024
@thabaum
Copy link
Contributor

thabaum commented Jan 1, 2025

After testing the build process things worked fine, however, when I went to update the package through Visual Studio Nuget Package Manager I ran into an error:

There are 2 package sources defined in your configuration. When using central package management, please map your package sources with package source mapping (https://aka.ms/nuget-package-source-mapping) or specify a single package source. The following sources are defined: nuget.org, NuGetOrg

Since I never used CPM before this was a new issue for me to resolve.

In order to resolve it I had to go to %appdata%\Roaming\NuGet\NuGet.Config and edit the file removing the extra NuGetOrg entry so it only had one package source value as shown below:

<configuration>
  <packageSources>
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
  </packageSources>
</configuration>

We may need to add some troubleshooting support in documentation to help others down the road with the same issue who may be unfamiliar with using this and run into the same issue.

@sbwalker
Copy link
Member

I am closing this PR as I would prefer to not utilize centralized package management in Oqtane

@sbwalker sbwalker closed this Jan 13, 2025
@leigh-pointer leigh-pointer deleted the ManagePackageVersionsCentrally branch January 22, 2025 12:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants