[WinML Bug Bash] [Sample] Fix C++ vcxproj NuGet version drift and PlatformToolset#621
[WinML Bug Bash] [Sample] Fix C++ vcxproj NuGet version drift and PlatformToolset#621yeelam-gordon wants to merge 2 commits intomainfrom
Conversation
…tformToolset - Update all NuGet package versions in vcxproj Import paths, Error conditions, and packages.config to match versions expected by Runtime 1.8.260317003: - InteractiveExperiences: 1.8.260125001 - Foundation: 1.8.260222000 - WinUI: 1.8.260224000 - AI: 1.8.53 - ML: 1.8.2141 - Runtime: 1.8.260317003 - WebView2: 1.0.3405.78 - Replace hardcoded PlatformToolset v143 with \ for VS 2022/2025/2026 compatibility ADO Bug: #61791039 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Aligns WindowsML C++ sample project dependency versions and toolset selection to avoid NuGet “version drift” and improve compatibility with newer Visual Studio toolsets.
Changes:
- Updated multiple
packages.config/.vcxprojfiles to align specific WinAppSDK component package versions (AI/ML/Foundation/InteractiveExperiences/Runtime/WinUI). - Replaced hardcoded
v143with$(DefaultPlatformToolset)across projects. - Updated MSBuild import/ensure paths for the revised package versions.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| Samples/WindowsML/cpp/CppResnetBuildDemo/CppResnetBuildDemo/packages.config | Updates WinAppSDK component package versions for the Resnet sample. |
| Samples/WindowsML/cpp/CppResnetBuildDemo/CppResnetBuildDemo/CppResnetBuildDemo.vcxproj | Updates WinAppSDK import/ensure paths; switches toolset to $(DefaultPlatformToolset). |
| Samples/WindowsML/cpp/CppConsoleDll/WindowsMLWrapper/packages.config | Updates WinAppSDK component package versions for the wrapper DLL. |
| Samples/WindowsML/cpp/CppConsoleDll/WindowsMLWrapper/WindowsMLWrapper.vcxproj | Updates WinAppSDK import/ensure paths; switches toolset to $(DefaultPlatformToolset). |
| Samples/WindowsML/cpp/CppConsoleDll/ConsoleClient/ConsoleClient.vcxproj | Switches toolset to $(DefaultPlatformToolset). |
| Samples/WindowsML/cpp/CppConsoleDesktop/packages.config | Updates WinAppSDK component package versions for CppConsoleDesktop. |
| Samples/WindowsML/cpp/CppConsoleDesktop/CppConsoleDesktop.vcxproj | Updates WinAppSDK import/ensure paths; switches toolset to $(DefaultPlatformToolset). |
| Samples/WindowsML/cpp/CppConsoleDesktop.SelfContained/packages.config | Updates WinAppSDK component versions used by the self-contained variant. |
| Samples/WindowsML/cpp/CppConsoleDesktop.SelfContained/CppConsoleDesktop.SelfContained.vcxproj | Updates WinAppSDK import/ensure paths; switches toolset to $(DefaultPlatformToolset). |
| Samples/WindowsML/cpp/CppConsoleDesktop.GenAI/packages.config | Updates WinAppSDK component versions for the GenAI sample. |
| Samples/WindowsML/cpp/CppConsoleDesktop.GenAI/CppConsoleDesktop.GenAI.vcxproj | Updates WinAppSDK import/ensure paths; switches toolset to $(DefaultPlatformToolset). |
| Samples/WindowsML/cpp/CppConsoleDesktop.FrameworkDependent/packages.config | Updates WinAppSDK component versions used by the framework-dependent variant. |
| Samples/WindowsML/cpp/CppConsoleDesktop.FrameworkDependent/CppConsoleDesktop.FrameworkDependent.vcxproj | Updates WinAppSDK import/ensure paths; switches toolset to $(DefaultPlatformToolset). |
| Samples/WindowsML/cpp-abi/packages.config | Updates WinAppSDK component versions used by the ABI sample. |
| Samples/WindowsML/cpp-abi/CppAbiEPEnumerationSample.vcxproj | Updates WinAppSDK import/ensure paths; switches toolset to $(DefaultPlatformToolset). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| <?xml version="1.0" encoding="utf-8"?> | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <packages> | ||
| <package id="Microsoft.Web.WebView2" version="1.0.3179.45" targetFramework="native" /> |
There was a problem hiding this comment.
This packages.config still pins WebView2 to 1.0.3179.45, but the corresponding .vcxproj imports WebView2 1.0.3405.78 targets. That mismatch can break builds after restore (targets path won’t exist for the restored version). Update the packages.config WebView2 version to match the .vcxproj (or vice versa) so restore and MSBuild imports stay consistent.
| <package id="Microsoft.Web.WebView2" version="1.0.3179.45" targetFramework="native" /> | |
| <package id="Microsoft.Web.WebView2" version="1.0.3405.78" targetFramework="native" /> |
| <?xml version="1.0" encoding="utf-8"?> | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <packages> | ||
| <package id="Microsoft.Web.WebView2" version="1.0.3179.45" targetFramework="native" /> |
There was a problem hiding this comment.
WebView2 is pinned to 1.0.3179.45 here, but the project file imports WebView2 1.0.3405.78 targets. This inconsistency can cause MSBuild import failures depending on what NuGet restores. Align the WebView2 version between packages.config and the .vcxproj import/ensure paths.
| <package id="Microsoft.Web.WebView2" version="1.0.3179.45" targetFramework="native" /> | |
| <package id="Microsoft.Web.WebView2" version="1.0.3405.78" targetFramework="native" /> |
| <package id="Microsoft.WindowsAppSDK.WinUI" version="1.8.260224000" targetFramework="native" /> | ||
| <package id="Microsoft.Windows.CppWinRT" version="2.0.240405.15" targetFramework="native" /> | ||
| <package id="Microsoft.Windows.ImplementationLibrary" version="1.0.240803.1" targetFramework="native" /> | ||
| <package id="Microsoft.Web.WebView2" version="1.0.3179.45" targetFramework="native" /> |
There was a problem hiding this comment.
This packages.config uses WebView2 1.0.3179.45, while WindowsMLWrapper.vcxproj imports WebView2 1.0.3405.78 targets. That can lead to missing .targets during build after restore. Update one side so the restored package version matches the MSBuild import paths.
| <package id="Microsoft.Web.WebView2" version="1.0.3179.45" targetFramework="native" /> | |
| <package id="Microsoft.Web.WebView2" version="1.0.3405.78" targetFramework="native" /> |
| @@ -5,13 +5,13 @@ | |||
| <NugetPackageDirectory Condition="'$(NugetPackageDirectory)'==''">..\..\..\packages</NugetPackageDirectory> | |||
| </PropertyGroup> | |||
| <Import Project="$(NugetPackageDirectory)\Microsoft.WindowsAppSDK.1.8.260101001\build\native\Microsoft.WindowsAppSDK.props" Condition="Exists('$(NugetPackageDirectory)\Microsoft.WindowsAppSDK.1.8.260101001\build\native\Microsoft.WindowsAppSDK.props')" /> | |||
There was a problem hiding this comment.
The PR description says NuGet versions are aligned to Runtime 1.8.260317003 (WinAppSDK 1.8.6), but this project still hardcodes Microsoft.WindowsAppSDK imports/error-checks to 1.8.260101001. If the intent is full alignment to the new WinAppSDK build, update the Microsoft.WindowsAppSDK.* import and error paths (and the corresponding packages.config entry) to the aligned version. If this is intentionally left at 1.8.260101001, the PR description should be adjusted to reflect that the meta package remains pinned.
| <Import Project="$(NugetPackageDirectory)\Microsoft.WindowsAppSDK.Widgets.1.8.251231004\build\native\Microsoft.WindowsAppSDK.Widgets.targets" Condition="Exists('$(NugetPackageDirectory)\Microsoft.WindowsAppSDK.Widgets.1.8.251231004\build\native\Microsoft.WindowsAppSDK.Widgets.targets')" /> | ||
| <Import Project="$(NugetPackageDirectory)\Microsoft.WindowsAppSDK.WinUI.1.8.251222000\build\native\Microsoft.WindowsAppSDK.WinUI.targets" Condition="Exists('$(NugetPackageDirectory)\Microsoft.WindowsAppSDK.WinUI.1.8.251222000\build\native\Microsoft.WindowsAppSDK.WinUI.targets')" /> | ||
| <Import Project="$(NugetPackageDirectory)\Microsoft.WindowsAppSDK.WinUI.1.8.260224000\build\native\Microsoft.WindowsAppSDK.WinUI.targets" Condition="Exists('$(NugetPackageDirectory)\Microsoft.WindowsAppSDK.WinUI.1.8.260224000\build\native\Microsoft.WindowsAppSDK.WinUI.targets')" /> | ||
| <Import Project="$(NugetPackageDirectory)\Microsoft.WindowsAppSDK.1.8.260101001\build\native\Microsoft.WindowsAppSDK.targets" Condition="Exists('$(NugetPackageDirectory)\Microsoft.WindowsAppSDK.1.8.260101001\build\native\Microsoft.WindowsAppSDK.targets')" /> |
There was a problem hiding this comment.
The PR description says NuGet versions are aligned to Runtime 1.8.260317003 (WinAppSDK 1.8.6), but this project still hardcodes Microsoft.WindowsAppSDK imports/error-checks to 1.8.260101001. If the intent is full alignment to the new WinAppSDK build, update the Microsoft.WindowsAppSDK.* import and error paths (and the corresponding packages.config entry) to the aligned version. If this is intentionally left at 1.8.260101001, the PR description should be adjusted to reflect that the meta package remains pinned.
| <Error Condition="!Exists('$(NugetPackageDirectory)\Microsoft.WindowsAppSDK.1.8.260101001\build\native\Microsoft.WindowsAppSDK.props')" Text="$([System.String]::Format('$(ErrorText)', '$(NugetPackageDirectory)\Microsoft.WindowsAppSDK.1.8.260101001\build\native\Microsoft.WindowsAppSDK.props'))" /> | ||
| <Error Condition="!Exists('$(NugetPackageDirectory)\Microsoft.WindowsAppSDK.1.8.260101001\build\native\Microsoft.WindowsAppSDK.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(NugetPackageDirectory)\Microsoft.WindowsAppSDK.1.8.260101001\build\native\Microsoft.WindowsAppSDK.targets'))" /> |
There was a problem hiding this comment.
The PR description says NuGet versions are aligned to Runtime 1.8.260317003 (WinAppSDK 1.8.6), but this project still hardcodes Microsoft.WindowsAppSDK imports/error-checks to 1.8.260101001. If the intent is full alignment to the new WinAppSDK build, update the Microsoft.WindowsAppSDK.* import and error paths (and the corresponding packages.config entry) to the aligned version. If this is intentionally left at 1.8.260101001, the PR description should be adjusted to reflect that the meta package remains pinned.
| <PropertyGroup Label="Configuration"> | ||
| <ConfigurationType>Application</ConfigurationType> | ||
| <PlatformToolset>v143</PlatformToolset> | ||
| <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> |
There was a problem hiding this comment.
$(DefaultPlatformToolset) is generally available in VS-driven builds, but it can be empty/undefined in some MSBuild environments, which results in an unset PlatformToolset and a build failure. Consider adding a conditional fallback (e.g., use $(DefaultPlatformToolset) when set, otherwise fall back to a known toolset like v143) to keep command-line/older agent builds robust.
| <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> | |
| <PlatformToolset Condition="'$(DefaultPlatformToolset)' != ''">$(DefaultPlatformToolset)</PlatformToolset> | |
| <PlatformToolset Condition="'$(DefaultPlatformToolset)' == ''">v143</PlatformToolset> |
…ppSDK, add toolset fallback - Update WebView2 from 1.0.3179.45 to 1.0.3405.78 in 3 packages.config files to match the version imported by vcxproj files - Add v143 fallback for in all 8 vcxproj files to handle MSBuild environments where the property is empty Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 15 out of 15 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.
Summary
Fix NuGet package version drift and PlatformToolset compatibility across all C++ WindowsML sample projects.
Problem
C++ .vcxproj files hardcode NuGet package versions in three places per file (MSBuild Import paths, Error conditions, and packages.config). Different samples had been updated at different times, resulting in inconsistent/outdated versions that didn't match the actual restored packages.
Additionally, PlatformToolset was hardcoded to �143 (VS 2022 only), blocking builds on newer Visual Studio versions.
Changes
NuGet version alignment — Updated all 15 C++ vcxproj and packages.config files to versions expected by Runtime 1.8.260317003 (WinAppSDK 1.8.6):
PlatformToolset — Replaced hardcoded �143 with $(DefaultPlatformToolset) for VS 2022/2025/2026 compatibility.
Validation
All 8 C++ projects build successfully (Release/x64):
ADO Bug
Fixes AB#61791039