Add automatic dependency inclusion and central package management #331
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
This PR addresses issue #[issue_number] by implementing automatic dependency inclusion and central package management for the Xunit.Microsoft.DependencyInjection library. Users no longer need to manually install Microsoft.Extensions.* dependencies - they're now automatically included when installing the main package.
Changes Made
1. Central Package Management
Directory.Packages.propsat the repository root to centrally manage all package versions2. Automatic Dependency Inclusion
Updated the main package to include all required Microsoft.Extensions dependencies as direct references:
These dependencies are now transitively included when users install the main package, eliminating manual setup steps.
3. Simplified Installation Documentation
Updated the README.md to reflect the streamlined installation process:
Before:
After:
4. Example Project Updates
Benefits
Verification
All existing functionality remains unchanged:
Breaking Changes
None. This is a purely additive change that maintains full backward compatibility. Existing projects will continue to work without any modifications.
Original prompt
This section details on the original issue you should resolve
<issue_title>Add Required Dependencies to the Main Package for Automatic Inclusion and Central Package Management</issue_title>
<issue_description>Is your feature request related to a problem? Please describe.
Currently, users of the Xunit.Microsoft.DependencyInjection NuGet package must manually add all required Microsoft.Extensions.* dependencies to their test projects. This manual step is error-prone and leads to confusion or missed dependencies, especially for new users onboarding the package. Additionally, dependency version management across multiple projects in a solution can become inconsistent without central management.
Describe the solution you'd like
<PackageReference>in its.csprojfile. This will allow automatic transitive inclusion of these dependencies when users install the main package, eliminating the need to add each dependency manually.Required dependencies to add:
Example addition to the main package
.csproj:Add a
Directory.Packages.propsfile at the root of the repository to declare and centrally manage all package versions. This ensures all projects in the solution use consistent package versions, simplifies upgrades, and improves maintainability.Example
Directory.Packages.propsfile:Individual project files should then reference packages without a version:
Update the README.md file to reflect the enhancements made in the "section/step 1" above in this issue
Describe alternatives you've considered
Additional context
See: Repository README for current manual installation instructions.
See: Central Package Management documentation for details.
These changes will improve the user experience, reduce setup errors, and ensure consistent, maintainable dependency management for all consumers of the package.</issue_description>
#...
Fixes #330
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.