Skip to content

[WinML Bug Bash] [Sample] Fix C++ vcxproj NuGet version drift and PlatformToolset#621

Open
yeelam-gordon wants to merge 2 commits intomainfrom
fix/61791039-vcxproj-version-drift
Open

[WinML Bug Bash] [Sample] Fix C++ vcxproj NuGet version drift and PlatformToolset#621
yeelam-gordon wants to merge 2 commits intomainfrom
fix/61791039-vcxproj-version-drift

Conversation

@yeelam-gordon
Copy link
Copy Markdown
Contributor

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):

Package Aligned Version
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

PlatformToolset — Replaced hardcoded �143 with $(DefaultPlatformToolset) for VS 2022/2025/2026 compatibility.

Validation

All 8 C++ projects build successfully (Release/x64):

  • CppAbiEPEnumerationSample ✅
  • CppConsoleDesktop ✅
  • CppConsoleDesktop.FrameworkDependent ✅
  • CppConsoleDesktop.SelfContained ✅
  • CppConsoleDesktop.GenAI ✅
  • CppResnetBuildDemo ✅
  • WindowsMLWrapper ✅
  • ConsoleClient ✅

ADO Bug

Fixes AB#61791039

…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>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 / .vcxproj files to align specific WinAppSDK component package versions (AI/ML/Foundation/InteractiveExperiences/Runtime/WinUI).
  • Replaced hardcoded v143 with $(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" />
Copy link

Copilot AI Apr 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
<package id="Microsoft.Web.WebView2" version="1.0.3179.45" targetFramework="native" />
<package id="Microsoft.Web.WebView2" version="1.0.3405.78" targetFramework="native" />

Copilot uses AI. Check for mistakes.
<?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" />
Copy link

Copilot AI Apr 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
<package id="Microsoft.Web.WebView2" version="1.0.3179.45" targetFramework="native" />
<package id="Microsoft.Web.WebView2" version="1.0.3405.78" targetFramework="native" />

Copilot uses AI. Check for mistakes.
<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" />
Copy link

Copilot AI Apr 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
<package id="Microsoft.Web.WebView2" version="1.0.3179.45" targetFramework="native" />
<package id="Microsoft.Web.WebView2" version="1.0.3405.78" targetFramework="native" />

Copilot uses AI. Check for mistakes.
@@ -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')" />
Copy link

Copilot AI Apr 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
<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')" />
Copy link

Copilot AI Apr 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment on lines 109 to 110
<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'))" />
Copy link

Copilot AI Apr 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
<PropertyGroup Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v143</PlatformToolset>
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
Copy link

Copilot AI Apr 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$(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.

Suggested change
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
<PlatformToolset Condition="'$(DefaultPlatformToolset)' != ''">$(DefaultPlatformToolset)</PlatformToolset>
<PlatformToolset Condition="'$(DefaultPlatformToolset)' == ''">v143</PlatformToolset>

Copilot uses AI. Check for mistakes.
…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>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@yeelam-gordon yeelam-gordon requested a review from timkur April 14, 2026 23:00
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