-
Notifications
You must be signed in to change notification settings - Fork 711
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 #5793
Comments
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. <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> |
Thanks @asklar for identifying the issue. I've sent mail to the WebView2 nupkg owners to ask them to fix this. |
Hey @asklar - I've opened this issue in the WebView2Feedback repo and will follow-up there. Thanks! |
It looks like both the official 2.7 and the latest prerelease (https://www.nuget.org/packages/Microsoft.UI.Xaml/2.7.0-prerelease.210913003) no longer directly depend on WebView2 and so this no longer repros (unless you manually add a dependency on a still broken version of WebView2 package) |
It looks like the latest WebView2 prerelease tries to fix the missing winmd: https://www.nuget.org/packages/Microsoft.Web.WebView2/1.0.1018-prerelease But you have to specify |
@jonthysell Yes that's correct. The intent is to then have the WinUI package default to setting |
yes. We need to update the docs to explain this. Not sure if this should be in this repo as a note, or in the winui readme that gets created when you add the nuget package to a project, or the xaml islands docs. |
Now that the property is available, we should just add that property to the WinUI2 nupkg targets. Something like:
@asklar can you hack your WinUI2 targets locally and see if that would address it? |
@jevansaks 'tis working. PR here #5990 |
Thanks! Yes the nuspec renames it: microsoft-ui-xaml/build/NuSpecs/MUXControls.nuspec Lines 36 to 37 in af57e7f
|
🎉This issue was addressed in #5990, which has now been successfully released as Handy links: |
🎉This issue was addressed in #5990, which has now been successfully released as Handy links: |
I just hit this while upgrading to 2.8 from 2.7. This issue is not fixed. |
can you check in the binlog if |
However, the build still fails |
It's easy to reproduce as well. Simply creating a new C++ console project, then installing C++/WinRT and WinUI 2.8 via NuGet, will produce the following error:
|
@sylveon Which version of WebView2 nuget is being used by your app? If you use an earlier preview 2.8 WinUI version or older WebView2 version does it work, or do you get the same error? |
@champnic My app does not directly use WV2, it is brought in as a transitive dependency of WinUI 2.8 If I install WinUI 2.8 from Visual Studio's package manager, it automatically installs Microsoft.Web.Webview2 version 1.0.1264.42. I cannot install an older version of the WV2 NuGet without VS also forcing me to downgrade to WinUI 2.7.2 (in which case I wouldn't need the WV2 NuGet at all). However, upgrading WebView2 to 1.0.1305-prerelease works. Installing WinUI 2.8.0-prerelease.220601001 and older works as well, and this brings in WV2 1.0.1020.30. I am told by WV2 and WinUI 2 docs to avoid using prerelease versions to ship production apps. Prerelease WinUI 2.8 also is missing some bug fixes, and ships itself entirely with my app, turning a 2MB app download into a ~30MB one (a 1400% increase), so prerelease versions are undesirable to ship the final production app. |
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. |
Weird - it works if I update to 1.0.305-prerelease, build, and then downgrade to 1.0.1264.42, even after running "Clean" and deleting the build folder. Do you see the same thing @sylveon? |
Weird, it even seems to reproduce across projects, so now installing WinUI 2.8 on a new project "just works" |
NVM the part about cross-project, I had forgot to install cppwinrt. I can reproduce this on a brand new project. |
It seems to be ordering dependent. As long as the build system evaluates WebView2 .targets file after the XAML .targets file it builds fine. I can upgrade to 1.0.305-prerelease and downgrade WITHOUT building in between, and it starts working fine. |
I think I see what the problem is. When you add a nuget package reference, VS will add imports for the package’s props and targets. Props go at the top, targets at the bottom. Neither WinUI nor webview have a props file in the right location in the package (in This means that it’s possible for webview2’s targets to be imported before winui’s targets (and therefore the winui props), rendering the project unbuildable. I think the right solution is for WinUI to move its props file to the build/native directory, and remove the weird Import:
|
for the time being, a workaround is to switch the order of these lines in your vcxproj: - <Import Project="packages\Microsoft.Web.WebView2.1.0.1264.42\build\native\Microsoft.Web.WebView2.targets" Condition="Exists('packages\Microsoft.Web.WebView2.1.0.1264.42\build\native\Microsoft.Web.WebView2.targets')" />
<Import Project="packages\Microsoft.UI.Xaml.2.8.0\build\native\Microsoft.UI.Xaml.targets" Condition="Exists('packages\Microsoft.UI.Xaml.2.8.0\build\native\Microsoft.UI.Xaml.targets')" />
+ <Import Project="packages\Microsoft.Web.WebView2.1.0.1264.42\build\native\Microsoft.Web.WebView2.targets" Condition="Exists('packages\Microsoft.Web.WebView2.1.0.1264.42\build\native\Microsoft.Web.WebView2.targets')" /> |
This issue has been resolved by #7574, and is available in the 2.8.1 release. |
Correct, appears fixed in 2.8.1 now, thanks! |
Describe the bug
I upgraded a Win32 C++/WinRT app to WinUI 2.7.0-prerelease.210827001, now I get a cppwinrt error:
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
The text was updated successfully, but these errors were encountered: