Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't build any xaml islands app with 2.7.0-prerelease.210827001 #1716

Closed
champnic opened this issue Sep 8, 2021 · 3 comments
Closed

Can't build any xaml islands app with 2.7.0-prerelease.210827001 #1716

champnic opened this issue Sep 8, 2021 · 3 comments
Labels
bug Something isn't working tracked We are tracking this work internally.

Comments

@champnic
Copy link
Member

champnic commented Sep 8, 2021

Originally asked by @asklar here: microsoft/microsoft-ui-xaml#5793

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

This works in a uwp cppwinrt app, but for a regular win32 app, something is not passing the webview2 winmd file to cppwinrt

The problem seems to come from the webview2 pkg.
In \packages\Microsoft.Web.WebView2.1.0.955-prerelease\build\Common.targets, it says:

<ItemGroup Condition="'$(TargetPlatformIdentifier)' == 'UAP'">
  <Reference Include="$(MSBuildThisFileDirectory)..\lib\Microsoft.Web.WebView2.Core.winmd">
    <Implementation>Microsoft.Web.WebView2.Core.dll</Implementation>
  </Reference>
  <ReferenceCopyLocalPaths Include="$(MSBuildThisFileDirectory)..\runtimes\win-$(EffectivePlatform)\native_uap\Microsoft.Web.WebView2.Core.dll" />
  <SDKReference Include="Microsoft.VCLibs.Desktop, Version=14.0"/>
</ItemGroup>

However this won't be evaluated for non-UWP apps like win32 xaml islands apps.

Putting this in the xaml islands project seems to get it building:

  <PropertyGroup>
    <EffectivePlatform>$(Platform)</EffectivePlatform>
    <EffectivePlatform Condition="'$(Platform)' == 'Win32'">x86</EffectivePlatform>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="packages\Microsoft.Web.WebView2.1.0.955-prerelease\lib\Microsoft.Web.WebView2.Core.winmd">
      <Implementation>Microsoft.Web.WebView2.Core.dll</Implementation>
    </Reference>
    <ReferenceCopyLocalPaths Include="packages\Microsoft.Web.WebView2.1.0.955-prerelease\runtimes\win-$(EffectivePlatform)\native_uap\Microsoft.Web.WebView2.Core.dll" />
  </ItemGroup>

AB#35837927

@champnic champnic added bug Something isn't working tracked We are tracking this work internally. labels Sep 8, 2021
@champnic
Copy link
Member Author

champnic commented Oct 8, 2021

This should be working in SDK 1.0.1018-prerelease. Thanks!

@champnic champnic closed this as completed Oct 8, 2021
@joseartrivera
Copy link

This is still reproing for me on 1.0.1018-prerelease

@asklar
Copy link

asklar commented Oct 14, 2021

This is still reproing for me on 1.0.1018-prerelease

make sure your project sets the property: microsoft/microsoft-ui-xaml#5793 (comment)

(newer versions of the winui package will set this property for you)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working tracked We are tracking this work internally.
Projects
None yet
Development

No branches or pull requests

3 participants