Use Centralized Nuget Package Management for vcxproj - #579
Use Centralized Nuget Package Management for vcxproj#579Gordon Lam (yeelam-gordon) merged 27 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request modernizes NuGet package management across C++ sample projects by migrating from the legacy packages.config approach to the modern PackageReference style with centralized version management. This change simplifies dependency management, reduces project file complexity, and aligns with current Visual Studio and MSBuild best practices.
- Migrates all C++ .vcxproj projects to use PackageReference-style NuGet management
- Removes all packages.config files and associated manual Import statements
- Updates UpdateVersions.ps1 to remove obsolete packages.config processing logic
- Enables centralized package version management through Directory.Packages.props
- Removes C# project version attributes to rely on centralized management
Reviewed changes
Copilot reviewed 172 out of 222 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| UpdateVersions.ps1 | Simplified package installation logic; removed packages.config, vcxproj, wapproj, and csproj version update code blocks |
| Multiple .vcxproj files | Added NuGet PackageReference properties, added PackageReference elements, removed Import statements and packages.config references |
| Multiple packages.config files | Deleted (migration to PackageReference) |
| Directory.Build.props files | Added MSBuild warning suppressions and centralized package management settings |
| Directory.Packages.props | Updated package versions; removed granular WindowsAppSDK sub-packages |
| Multiple .csproj/.wapproj files | Removed explicit Version attributes to use centralized versions |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 214 out of 312 changed files in this pull request and generated 23 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 214 out of 312 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
0d035e0
into
release/experimental
* Built successful one in 1st round * Untried one, but AI converted * 2nd Fix * 3rd changes * 4th Fix * Fix WinML build issue * 5th fix * Fix WindowsAISample.csproj restore nuget problem * Fix further build issue * Ensure only 1 newline, not multiple, for csproj and vcxproj * Try to have reliable version update for Directory.Packages.props * Test failure because the waproj doesn't reference correct MSVCP * Fix build error for CsWpfState/CsWpfState.csproj * Fix CppWinMainEnv failed to launch with error VCRuntime140_1.dll not found * Add missing VCRForwarders * Fix copilot comment * Convert WinUI3 to single package - starting with Instancing * Update the rest to be single package * pdateVersions.ps1 should restore package even when packages folder not provided * Remove all vcxproj.filters's packages.config reference * Restore some of original property - phase 1 * Restore original packages path * Remove extra symbols * Restore originally appxmanifest value for those migrated one * remove unnecessary property in Directory.Build.props for WinML * Add warning only if restore not successful * Nuget install on pipeline will be done itself, it cannot fail
…) (#590) * Built successful one in 1st round * Untried one, but AI converted * 2nd Fix * 3rd changes * 4th Fix * Fix WinML build issue * 5th fix * Fix WindowsAISample.csproj restore nuget problem * Fix further build issue * Ensure only 1 newline, not multiple, for csproj and vcxproj * Try to have reliable version update for Directory.Packages.props * Test failure because the waproj doesn't reference correct MSVCP * Fix build error for CsWpfState/CsWpfState.csproj * Fix CppWinMainEnv failed to launch with error VCRuntime140_1.dll not found * Add missing VCRForwarders * Fix copilot comment * Convert WinUI3 to single package - starting with Instancing * Update the rest to be single package * pdateVersions.ps1 should restore package even when packages folder not provided * Remove all vcxproj.filters's packages.config reference * Restore some of original property - phase 1 * Restore original packages path * Remove extra symbols * Restore originally appxmanifest value for those migrated one * remove unnecessary property in Directory.Build.props for WinML * Add warning only if restore not successful * Nuget install on pipeline will be done itself, it cannot fail Co-authored-by: Gordon Lam <73506701+yeelam-gordon@users.noreply.github.com>
|
Gordon Lam (@yeelam-gordon) would this change be eventually ported to |
Description
This pull request modernizes the NuGet package management approach for the C++ Win32 and Console Activation sample projects. The changes migrate the projects from using the legacy
packages.configand explicit.props/.targetsimports to the newerPackageReferencestyle, simplifying dependency management and project files.Key changes include:
Migration to PackageReference style:
Updated all vcxproj to use the
PackageReferenceNuGet style, including new properties such asRestoreProjectStyle,NuGetTargetMoniker, and platform-specific identifiers. This change streamlines NuGet package handling and aligns with modern Visual Studio practices.Added direct
<PackageReference>entries forMicrosoft.WindowsAppSDKandMicrosoft.Windows.CppWinRTin theCppWinRtConsoleActivation.vcxprojfile, replacing the need for explicit version management and manual imports.Cleanup of legacy NuGet configuration:
Removed the
packages.configfile and its reference from the project, fully deprecating the old NuGet package management mechanism. [1] [2]Deleted all explicit
.propsand.targetsimports, as well as the custom NuGet error-checking target, from the project files. These are now handled automatically by the PackageReference system, reducing clutter and potential for misconfiguration. [1] [2] [3]These updates make the projects easier to maintain and ensure compatibility with current and future Visual Studio tooling.
Target Release
Please specify which release this PR should align with 2.0
Checklist
Note that /azp run currently isn't working for this repo.