UWP WebView2无法与安装的WebView2 Runtime一起使用

问题描述

我已经创建了一个WinUI 3.0 UWP应用程序,并根据documentation安装了WebView2运行时。 当我根据documentation检查regkey及其pv属性时,它已设置。但是,启动应用程序时,无论是在调试还是发行版中,我都发现未检测到合适的Microsoft Edge版本

XML本身非常简单:

class ContactBase(BaseModel):
    name: str
    email: str
    subject: str

class ContactCreate(BaseModel):
    pass

class Contact(ContactBase):
    id: int

    class Config:
        orm_mode = True

文档指出,也应该可以依靠WebView2运行时进行开发:

在开发和测试期间,您可以将其用作支持Web平台。

  • WebView2运行时
  • 任何Insider(不稳定)的Microsoft Edge(铬)浏览器频道

让任何人设法直接运行而无需直接安装Microsoft Edge的BETA版本,因为这不是一个选择,也不是recommended

解决方法

请参阅Getting started with WebView2 in WinUI 3

中的先决条件

Introduction to Microsoft Edge WebView2

要查看特定版本的WebView2需要哪个版本的MS Edge,请参阅WebView2 Release Notes

https://www.microsoftedgeinsider.com/en-us/download下载MS Edge的最新开发版本。

以下文章显示了可以检查以确定已安装的MS Edge版本的一些内容。 How to detect if runtime is installed? #421