-
Notifications
You must be signed in to change notification settings - Fork 57
[Problem/Bug]: [NET 9] Dependency conflict #4924
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
Comments
The warning also occurs under .NET 8 and only since WebView2 version 1.0.2849.39. The message does not occur in WebView2 version 1.0.2792.45. |
I am wondering whether the issue you're encountering is a version conflict between different versions of the The warning states that I suspect when upgrading to a new .NET version, some dependencies might still reference older versions of assemblies, leading to conflicts. Possible Solutions
If you need further assistance or have any specific questions, feel free to ask! |
The problem goes away if you add this to your '.proj' file:
|
Thanks for the solution! Is there an explanation for this? Thanks! |
I don't call this a solution but a temporary workaround until they have fixed their dependency mess. I don't have an explanation (I found this on StackOverflow, don't have the link anymore, sorry). |
Downgrading also helps. In the case of a non desktop app (a class library) I'm not sure if it's a sufficient solution. |
I confirm, the warning disappears. Unfortunately, the error still persists. More: dotnet/msbuild#8289 (comment) |
I believe WindowsBase is only used by WPF? Why are we then getting this conflict when using Webview2 in a WindowsForms project? I.e. with a .csproj containing:
As others have stated, downgrading to 1.0.2792.45 makes the warning go away. |
Any fix on the way? MAUI just updated to v1.0.2903.40 and now I get MSB3277 for WindowsBase: Unfortunately, I have a dependency that is shared between a WinForms project and a MAUI project. When included in a WinForms project, it also bring in the the Wpf reference through Common.targets:
I'm not quite sure why both are being referenced when one of them likely isn't needed? The following works fine for me since it avoids bringing in the unnecessary/problematic reference:
|
@jeremy-visionaid, there is no official solution. One solution is to install an older version of WebView2, as I mentioned here: The second solution is here: I doubt this will be fixed anytime soon. The first issues appeared in version |
@sefinek Thanks for the suggestions. I did try It should have occured to me sooner, but what worked for me was to just remove the reference you don't need/want. e.g. for a WinForms project:
That addresses the root cause since the Wpf assembly won't try and bring in the conflicting WindowsBase |
@jeremy-visionaid: Unfortunately, in my case, this doesn't work - the compiler did not exclude |
@sefinek Oh darn - you're right. I was flitting between NuGet versions and forgot to revert my changes/fixes to Common.targets for the one I was using. Maybe it's still possible but through a target since that would get evaluated later. I'll have a crack at it, but it's getting late here and I obviously need some sleep 😅 |
@sefinek Might need some refinement, but try this instead:
|
@jeremy-visionaid wo, the warning disappears, but the error still occurs - because of it, MSIX Packaging Tool doesn't work. |
Oh darn, I'm afraid I can't help with MSIX stuff - I don't/can't use it for our app |
I don't use it in my main application either, so.. |
If it helps others, I finally settled on this for use/import through
|
|
Looks like it's missing the UseWindowsForms/UseWpf properties in the conditions? Otherwise it looks like it would be a good improvement to be more robust over time. I was kind of hoping that someone on the WebView2 team would notice the thread and fix the conditions. |
@jeremy-visionaid Yes it does not contain UseWindowsForms/UseWpf in condition attribute, for I'm using Avalonia :). |
Hi folks, chiming in from the .NET team. I had a look at dotnet/winforms#13358 and shared a workaround there. The right fix here is for WebView2 to add conditions in their targets. @soumamazu let me know if you need any help getting this done. |
@ericstj Thanks for weighing in too. Yeah, that's essentially what I was suggesting back in March. It's 6 months since the issue was reported for what looks like a reasonably trivial 2 line fix upstream. Pretty frustrating! |
What happened?
This phenomenon occurred after we upgraded to .NET 9.0, and a warning is generated during compilation:
File: Microsoft.Common.CurrentVersion.targets
The project does not use WPF or WinForms; it controls windows through the Win32 API (Set Handle). Therefore, there is actually no dependency on WindowBase at all. Previously, everything was normal in the .NET 8.0 environment.
Although the project is still running normally, we would also like to find the cause and eliminate this warning.
Thanks
Importance
Moderate. My app's user experience is affected, but still usable.
Runtime Channel
Stable release (WebView2 Runtime), Prerelease (Edge Canary/Dev/Beta)
Runtime Version
130.0.2849.80
SDK Version
1.0.2895-prerelease
Framework
Other
Operating System
Windows 11
OS Version
22631.4460
Repro steps
Upgrade to .NET 9.0
Repros in Edge Browser
No, issue does not reproduce in the corresponding Edge version
Regression
No, this never worked
Last working version (if regression)
No response
The text was updated successfully, but these errors were encountered: