Visual Studio Windows 应用 SDK C# 扩展的脱机安装失败

适用于: Visual Studio 2022

现象

为 Visual Studio 脱机安装 Windows 应用 SDK C# 扩展时,它将失败并显示以下错误消息:

Install Failed
The install of 'Windows App SDK C# VS2022 Templates' was not successful for all the selected products.
For more information, click on the install log link at the bottom of the dialog.
Windows App SDK C# VS2022 Templates
One or more errors occurred.

脱机安装 Visual Studio 2022 Windows 应用 SDK C# 扩展时错误消息的屏幕截图。

解决方法

若要对 Visual Studio 的 Windows 应用 SDK 扩展执行脱机安装,请运行以下命令行:

"C:\Program Files (x86)\Microsoft Visual Studio\Installer\resources\app\ServiceHub\Services\Microsoft.VisualStudio.Setup.Service\VSIXInstaller.exe" /noextensionpack <path to the WindowsAppSDK VSIX>

替换为<path to the WindowsAppSDK VSIX>Windows 应用 SDK VSIX 扩展文件的实际文件路径。 有关详细信息,请参阅 WinApp SDK Dev 17 脱机安装失败

此外,还可以使用创建第一个 WinUI 3 (Windows 应用 SDK) 项目来使用Windows 应用 SDK测试示例 WinUI 3 项目。