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

[Problem/Bug]: "WebView2" does not exist in namespace "clr-namespace:Microsoft.Web.WebView2.Wpf; #4925

Open
intrix-bob opened this issue Nov 14, 2024 · 3 comments
Assignees
Labels
bug Something isn't working regression Something used to work but doesn't anymore

Comments

@intrix-bob
Copy link

What happened?

Error while compiling .net wpf application using WebView2-Control: "WebView2" does not exist in namespace "clr-namespace:Microsoft.Web.WebView2.Wpf;

Visual Studio 2022: Project .net 8 (limited to Windows 10, X64)

Importance

Important. My app's user experience is significantly compromised.

Runtime Channel

Stable release (WebView2 Runtime)

Runtime Version

1.02849.39

SDK Version

.net 8

Framework

WPF

Operating System

Windows 10

OS Version

No response

Repro steps

with actual Release it doesn't work
With old "1.0.2478.35" no compile errors

Repros in Edge Browser

Yes, issue can be reproduced in the corresponding Edge version

Regression

Regression in newer Runtime

Last working version (if regression)

1.0.2478.35

@intrix-bob intrix-bob added the bug Something isn't working label Nov 14, 2024
@github-actions github-actions bot added the regression Something used to work but doesn't anymore label Nov 14, 2024
@sandeepchads
Copy link

The error message "WebView2 does not exist in namespace clr-namespace:Microsoft.Web.WebView2.Wpf" typically indicates that the WebView2 control is not properly referenced in your project. Here are some steps to troubleshoot and resolve this issue:

  1. Ensure the NuGet Package is Installed:

    • Make sure you have installed the Microsoft.Web.WebView2 NuGet package in your project. You can do this via the NuGet Package Manager or by running the following command in the Package Manager Console:
  2. Check the Project References:

    • Verify that your project references the Microsoft.Web.WebView2.Wpf assembly. You can do this by right-clicking on your project in Solution Explorer, selecting "Add Reference," and ensuring that the Microsoft.Web.WebView2.Wpf assembly is listed and checked.
  3. Add the Correct XML Namespace:

    • Ensure that you have added the correct XML namespace in your XAML file. It should look something like this:
  4. Clean and Rebuild Your Project:

    • Sometimes, Visual Studio needs a clean build to recognize new references. Go to "Build" -> "Clean Solution" and then "Build Solution."
      This is a common fix for such issues.

Let me know if you need further assistance!

@intrix-bob
Copy link
Author

No, I tried to update with nuget to the library to curret version 2849 - then there are no compile time assemblies (.core, winforms,wpf).
Then I switched back to an older version (2592). All is fine an the assiblies are here.
Allways tried to clean, rebuild and so on.

@jovienclauzade
Copy link

jovienclauzade commented Nov 26, 2024

I've been facing the exact same issue on my side.
I managed to pinpoint the exact version at which it started to be broken : 1.0.2651.64 and latest
Previously I've been using 1.0.2478.35 without any problem.

(tried every versions between 1.0.2478.35 and the current latest, cleaning the full solution cache + rebuilding the solution every time).

(on net9.0-windows TFM)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working regression Something used to work but doesn't anymore
Projects
None yet
Development

No branches or pull requests

4 participants