microsoft-ui-xaml: Can't build any xaml islands app with 2.7.0-prerelease.210827001

Describe the bug I upgraded a Win32 C++/WinRT app to WinUI 2.7.0-prerelease.210827001, now I get a cppwinrt error:

Rebuild started...
1>------ Rebuild All started: Project: Playground, Configuration: Debug Win32 ------
1>cppwinrt : error Type 'Microsoft.Web.WebView2.Core.CoreWebView2' could not be found
1> method: CoreWebView2
1> type: Microsoft.UI.Xaml.Controls.IWebView2
1> database: F:\xaml-islands\Playground\packages\Microsoft.UI.Xaml.2.7.0-prerelease.210827001\lib\uap10.0\Microsoft.UI.Xaml.winmd
1>F:\xaml-islands\Playground\packages\Microsoft.Windows.CppWinRT.2.0.210825.3\build\native\Microsoft.Windows.CppWinRT.targets(736,9): error MSB3073: The command ""F:\xaml-islands\Playground\packages\Microsoft.Windows.CppWinRT.2.0.210825.3\build\native\..\..\bin\"cppwinrt @"Debug\Playground.vcxproj.cppwinrt_ref.rsp"" exited with code 1.
1>Done building project "Playground.vcxproj" -- FAILED.
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

Steps to reproduce the bug Create C++/WinRT app, reference latest winui nuget, build.

Note this does not require me to use WebView2 in my project - the build error happens even before any of my code gets compiled.

Version Info

NuGet package version: Microsoft.UI.Xaml 2.7.0-prerelease.210827001 latest cppwinrt version: 2.0.210825.3 mux brought in webview2 pkg: 1.0.955-prerelease

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 1
  • Comments: 29 (19 by maintainers)

Most upvoted comments

Thanks @sylveon! I wasn’t trying to suggest using a prerelease package long-term, but just wanted info that would help us narrow down when the issue was introduced. At this point my best guess is that there is some difference between the release and prerelease versions of the WebView2 SDKs that is causing this - I’ll take a look at what the differences are.

Now that the property is available, we should just add that property to the WinUI2 nupkg targets. Something like:

<WebView2UseWinRT Condition="'$(WebView2UseWinRT)' ==''">true</WebView2UseWinRT>

@asklar can you hack your WinUI2 targets locally and see if that would address it?

@jonthysell Yes that’s correct. The intent is to then have the WinUI package default to setting <WebView2UseWinRT>true</WebView2UseWinRT>.