[英]WinUI3 EntryPointNotFoundException After VS 17.1.2 Update
I just installed Visual Studio 2022 17.2.1 and my WinUI3 Project does not run anymore.我刚刚安装了 Visual Studio 2022 17.2.1,我的 WinUI3 项目不再运行。
Even the installed app on my computer doesn't open.甚至我电脑上安装的应用程序也打不开。 When I try to compile and run within VS the follow error is generated
当我尝试在 VS 中编译和运行时,会生成以下错误
System.EntryPointNotFoundException: 'Unable to find an entry point named 'XamlCheckProcessRequirements' in DLL 'Microsoft.ui.xaml.dll'.'
System.EntryPointNotFoundException:“无法在 DLL‘Microsoft.ui.xaml.dll’中找到名为‘XamlCheckProcessRequirements’的入口点。”
After the update...the Microsoft.Ui.Xaml nuget package was causing the error.更新后... Microsoft.Ui.Xaml nuget 包导致错误。 Removing it solved to problem.
删除它解决了问题。
<PackageReference Include="Microsoft.UI.Xaml" Version="2.7.1"/>
I also had the problem.我也有这个问题。 I believe, I could fix the problem by creating the WinUI3 project using the correct project template.
我相信,我可以通过使用正确的项目模板创建 WinUI3 项目来解决问题。
Before, I used the "Windows App SDK extension" in Visual Studio 2022. Then I removed this extension and instead installed the item "Windows APP SDK C# Templates" from the Visual Studio installer (item from "Installation details").之前,我在 Visual Studio 2022 中使用了“Windows App SDK 扩展”。然后我删除了这个扩展,而是从 Visual Studio 安装程序中安装了“Windows APP SDK C# 模板”项目(“安装详细信息”中的项目)。
With the new / correct project template "Empty App, packaged (WinUI 3 in Desktop), I created a WinUI 3 project.使用新的/正确的项目模板“空应用程序,打包(桌面中的 WinUI 3),我创建了一个 WinUI 3 项目。
Here you find the relevant parts of the .cjproj file:在这里您可以找到 .cjproj 文件的相关部分:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows10.0.19041.0</TargetFramework>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
<RootNamespace>MyApp</RootNamespace>
<ApplicationManifest>app.manifest</ApplicationManifest>
<Platforms>x86;x64;arm64</Platforms>
<RuntimeIdentifiers>win10-x86;win10-x64;win10-arm64</RuntimeIdentifiers>
<PublishProfile>win10-$(Platform).pubxml</PublishProfile>
<UseWinUI>true</UseWinUI>
<EnablePreviewMsixTooling>true</EnablePreviewMsixTooling>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.1.2" />
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22621.1" />
<Manifest Include="$(ApplicationManifest)" />
</ItemGroup>
</Project>
You can see, that two Nuget Packages are required:您可以看到,需要两个 Nuget 包:
Microsoft.WindowsAppSDK
and Microsoft.Windows.SDK.BuildTools
. Microsoft.WindowsAppSDK
和Microsoft.Windows.SDK.BuildTools
。
As you see, I used Windows App SDK 1.1.2 at that time.如您所见,当时我使用的是 Windows App SDK 1.1.2。 (I you publish an unpackaged app, the respective Window App SDK needs to be installed on the system, i can be found here )
(我发布了一个未打包的应用程序,需要在系统上安装相应的Window App SDK,我可以在这里找到)
In the project settings, take a look at the value in TargetFramework
value.在项目设置中,看一下
TargetFramework
value 中的值。 It seems that a value of simply "net6.0" does not work.似乎只是“net6.0”的值不起作用。 In this post you will find this statement:
在这篇文章中,您将找到以下声明:
Changing net5.0-windows10.0.19041.0 to net6.0-windows10.0.19041.0 worked for me, too.
将 net5.0-windows10.0.19041.0 更改为 net6.0-windows10.0.19041.0 也对我有用。
Delete the version of your Microsoft.ui.xaml in this path and try to run your project.在此路径中删除您的 Microsoft.ui.xaml 的版本并尝试运行您的项目。 This solution worked for me
这个解决方案对我有用
C:\Users\UserName.nuget\packages\microsoft.ui.xaml C:\Users\UserName.nuget\packages\microsoft.ui.xaml
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.