Open JanKotschenreuther opened 4 months ago
Looking through this and the related issues, I think the root cause of this is https://github.com/microsoft/microsoft-ui-xaml/issues/5689.
The BlazorWebView uses WebView2 from whichever version of WinUI is referenced by MAUI, and that's where the conflict comes from. If the WinUI issue is fixed, then this should also work, and that's the underlying dependency conflict. I don't think that can be worked around in this repo without hacking the underlying core of WinUI 3, where it should really be fixed.
If you don't depend on WinUI3 controls, you could also use BlazorWebView in WPF and WinForms which shouldn't suffer this limitation from WindowsAppSDK.
Thanks for the hint to Blazor Hybrid in WPF and WinForms. Using WPF, we are able to publish a Blazor Hybrid app. Might be a good workaround until the root problem of this issue is solved. We would be happy to see a solution to the root problem, to be able to completly migrate to MAUI.
We have the same issue, and we have temporarily solved it by first setting
<ErrorOnDuplicatePublishOutputFiles>false</ErrorOnDuplicatePublishOutputFiles>
in the .csproj file.
And then, in our pipeline, after the project is published we replace Microsoft.Web.WebView2.Core.dll
with the one from the build folder:
cp {build_dir}/Microsoft.Web.WebView2.Core.dll {build_dir}/publish/Microsoft.Web.WebView2.Core.dll
(This bug stops us from publishing a single file unfortunately)
Verified this issue with maui version 8.0.14/8.0.0-rc.2.9530. Can repro this issue.
I have these issue with MAUI. I don't see now with updated Visual Studio version 17.10.3. I think it's fixed with MAUI version 8.0.40
Description
Whenever the package Microsoft.Web.WebView2 is included, publishing using the dotnet cli fails, because multiple output files are found for
Microsoft.Web.WebView2.Core.dll
.Disabling the error message using
-p:ErrorOnDuplicatePublishOutputFiles=false
suppresses the error message, but the application will display no content after starting the published application.Observing the publish output, it does not seem to contain the correct version of
Microsoft.Web.WebView2.Core.dll
, it is the version of the NuGet-Package but not the one required to correctly run the app.This is not only an issue for the direct usage but also transient usage of this package. For example, we got EF Core 8 models, which we want to reference and use in our Blazor Hybrid app. But EF Core references
Microsoft.Data.SqlClient
which referencesMicrosoft.Identity.Client
which referencesMicrosoft.Web.WebView2
.Steps to Reproduce
.NET MAUI Blazor Hybrid App
Add a package reference for Microsoft.EntityFrameworkCore.SqlServer or Microsoft.Data.SqlClient
Publish the project as described in Publish unpackaged using the dotnet cli using the following script.
Link to public reproduction project repository
https://github.com/JanKotschenreuther/ReproProjects/tree/main
Version with bug
8.0.6 SR1
Is this a regression from previous behavior?
Not sure, did not test other versions
Last version that worked well
Unknown/Other
Affected platforms
Windows
Affected platform versions
No response
Did you find any workaround?
Do not use the package Microsoft.Web.WebView2 directly or transiently. Pick one of the following actions:
In our case, we cannot make the effort to downgrade back to EF Core 6 with our models.
Similar issues i came accross on recherche:
Relevant log output
No response