WinUI 3 无法在 Visual Studio 2022 上运行

问题描述 投票:0回答:1

我使用 Visual Studio 社区使用 win10sdk 在我的系统上安装了 winui3。 我启动一个空白的 C# WinUI 应用程序,并在构建时收到此错误。 我什至没有写过任何代码。我已经修复了 IDE

IDE信息

Microsoft Visual Studio Community 2022
Version 17.9.6
VisualStudio.17.Release/17.9.6+34728.123
Microsoft .NET Framework
Version 4.8.09032

Installed Version: Community

Visual C++ 2022   00482-90000-00000-AA065
Microsoft Visual C++ 2022

ASP.NET and Web Tools   17.9.199.22661
ASP.NET and Web Tools

Azure App Service Tools v3.0.0   17.9.199.22661
Azure App Service Tools v3.0.0

Better Comments   BetterComments.Omar Rwemi.e985519f-8696-40b7-9400-807054b4ec76
Better Comments is a Visual Studio extension that gives you the ability to customize the font and opacity of your comments independently of the editor's font settings. It also adds four additional comment classifications, each classification with its own customizable foreground.

C# Tools   4.9.0-3.24121.1+a98c90d56455379836dd5c845b35fa932b00cfa3
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

GitHub Copilot   1.147.0.0 (v1.147.0.0@218a5ecac)
GitHub Copilot is an AI pair programmer that helps you write code faster and with less work.

GitHub Copilot Agent   1.147.0

Linux Core Dump Debugging   1.0.9.34714
Enables debugging of Linux core dumps.

Microsoft JVM Debugger   1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

NuGet Package Manager   6.9.2
NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/

TypeScript Tools   17.0.30103.2001
TypeScript Tools for Microsoft Visual Studio

Visual Basic Tools   4.9.0-3.24121.1+a98c90d56455379836dd5c845b35fa932b00cfa3
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Visual C++ for Linux Development   1.0.9.34714
Visual C++ for Linux Development

Visual F# Tools   17.9.0-beta.23614.3+a521e1cd420beb56c15faf6836184fadd2b7937a
Microsoft Visual F# Tools

Visual Studio IntelliCode   2.2
AI-assisted development for Visual Studio.

我希望像往常一样看到一个空白的应用程序窗口

我遇到错误

Severity    Code    Description Project File    Line    Suppression State
Error   XLS0414 The type 'Application' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built. App1    C:\Users\hp\Desktop\Scripts\C#\App1\App1\App.xaml   2   
Error   XLS0414 The type 'Application' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built. App1    C:\Users\hp\Desktop\Scripts\C#\App1\App1\App.xaml   7   
Error   XLS0414 The type 'ResourceDictionary' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built.  App1    C:\Users\hp\Desktop\Scripts\C#\App1\App1\App.xaml   8   
Error   XLS0414 The type 'ResourceDictionary' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built.  App1    C:\Users\hp\Desktop\Scripts\C#\App1\App1\App.xaml   9   
Error   XLS0414 The type 'XamlControlsResources' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built.   App1    C:\Users\hp\Desktop\Scripts\C#\App1\App1\App.xaml   10  
Warning NU1603  App1 depends on Microsoft.Windows.SDK.BuildTools (>= 10.0.22621.755) but Microsoft.Windows.SDK.BuildTools 10.0.22621.755 was not found. An approximate best match of Microsoft.Windows.SDK.BuildTools 10.0.22621.756 was resolved.  App1    C:\Users\hp\Desktop\Scripts\C#\App1\App1\App1.csproj    1   
Error   NU1101  Unable to find package Microsoft.WindowsAppSDK. No packages exist with this id in source(s): Microsoft Visual Studio Offline Packages   App1    C:\Users\hp\Desktop\Scripts\C#\App1\App1\App1.csproj    1   
Error   NU1101  Unable to find package Microsoft.NETCore.App.Runtime.win-x86. No packages exist with this id in source(s): Microsoft Visual Studio Offline Packages App1    C:\Users\hp\Desktop\Scripts\C#\App1\App1\App1.csproj    1   
Error   NU1101  Unable to find package Microsoft.Windows.SDK.NET.Ref. No packages exist with this id in source(s): Microsoft Visual Studio Offline Packages App1    C:\Users\hp\Desktop\Scripts\C#\App1\App1\App1.csproj    1   
Error   NU1101  Unable to find package Microsoft.AspNetCore.App.Runtime.win-x86. No packages exist with this id in source(s): Microsoft Visual Studio Offline Packages  App1    C:\Users\hp\Desktop\Scripts\C#\App1\App1\App1.csproj    1   
Error   NU1101  Unable to find package Microsoft.NETCore.App.Runtime.win-arm64. No packages exist with this id in source(s): Microsoft Visual Studio Offline Packages   App1    C:\Users\hp\Desktop\Scripts\C#\App1\App1\App1.csproj    1   
Error   NU1101  Unable to find package Microsoft.AspNetCore.App.Runtime.win-x64. No packages exist with this id in source(s): Microsoft Visual Studio Offline Packages  App1    C:\Users\hp\Desktop\Scripts\C#\App1\App1\App1.csproj    1   
Error   NU1101  Unable to find package Microsoft.WindowsDesktop.App.Runtime.win-arm64. No packages exist with this id in source(s): Microsoft Visual Studio Offline Packages    App1    C:\Users\hp\Desktop\Scripts\C#\App1\App1\App1.csproj    1   
Error   NU1101  Unable to find package Microsoft.WindowsDesktop.App.Runtime.win-x64. No packages exist with this id in source(s): Microsoft Visual Studio Offline Packages  App1    C:\Users\hp\Desktop\Scripts\C#\App1\App1\App1.csproj    1   
Error   NU1101  Unable to find package Microsoft.AspNetCore.App.Runtime.win-arm64. No packages exist with this id in source(s): Microsoft Visual Studio Offline Packages    App1    C:\Users\hp\Desktop\Scripts\C#\App1\App1\App1.csproj    1   
Error   NU1101  Unable to find package Microsoft.NETCore.App.Runtime.win-x64. No packages exist with this id in source(s): Microsoft Visual Studio Offline Packages App1    C:\Users\hp\Desktop\Scripts\C#\App1\App1\App1.csproj    1   
Error   NU1101  Unable to find package Microsoft.WindowsDesktop.App.Runtime.win-x86. No packages exist with this id in source(s): Microsoft Visual Studio Offline Packages  App1    C:\Users\hp\Desktop\Scripts\C#\App1\App1\App1.csproj    1   

我已经安装了win10SDK,桌面开发支持并在我的设置中启用了开发者模式

c# visual-studio winui-3 winui windows-app-sdk
1个回答
0
投票

似乎所需的 NuGet 包安装失败。

转到 Options >> NuGet Package Manager >> Package Sources 并确保您有以下源:

Name: nuget.org
Source: https://api.nuget.org/v3/index.json

构建应用程序时,将自动下载所需的 NuGet 包,但您需要互联网连接。

© www.soinside.com 2019 - 2024. All rights reserved.