Introduction

備忘録。
WinGet は Microsoft Store からのインストールが推奨されているためなのか、Microsoft Store が組み込まれていない Windows Server 2022 は非対応のような扱いになる。
Github から *.msixbundle をダウンロードしてインストールもできるが…これが一筋縄ではいかない。

確認環境は下記。

  • Edition: Windows Server 2022 Standard
  • Version: 21H2
  • OS build: 20348.587

How to resolve?

WinGet のインストール

Github の公式ページ Windows Package Manager の Release ページから 1.8.1911 タグから *.msixbundle をダウンロードしてインストールすること。
ここで 1.8.1911 より新しいパッケージをインストールすると後述の作業において、依存関係の解決ができなくなる。

まず、インストールするとエラーになることが確認できる。

1
2
3
4
5
6
7
8
9
10
11
12
13
$ Add-AppxPackage '.\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle'
Add-AppxPackage : Deployment failed with HRESULT: 0x80073CF3, Package failed updates, dependency or conflict validation.
Windows cannot install package Microsoft.DesktopAppInstaller_1.26.400.0_x64__8wekyb3d8bbwe because this package depends on a
framework that could not be found. Provide the framework "Microsoft.UI.Xaml.2.8" published by "CN=Microsoft Corporation,
O=Microsoft Corporation, L=Redmond, S=Washington, C=US", with neutral or x64 processor architecture and minimum version
8.2310.30001.0, along with this package to install. The frameworks with name "Microsoft.UI.Xaml.2.8" currently installed are: {}
NOTE: For additional information, look for [ActivityId] 9b1603cc-e5a4-0000-3066-169ba4e5db01 in the Event Log or
use the command line Get-AppPackageLog -ActivityID 9b1603cc-e5a4-0000-3066-169ba4e5db01
At line:1 char:1
+ Add-AppxPackage '.\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbu ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : WriteError: (C:\Users\Admini...bbwe.msixbundle:String) [Add-AppxPackage], IOException
+ FullyQualifiedErrorId : DeploymentError,Microsoft.Windows.Appx.PackageManager.Commands.AddAppxPackageCommand

Microsoft.UI.Xaml.2.8 のインストール

Microsoft.UI.Xaml.2.8 がインストールされていないということなのでこれを公式から持ってくる。
こちらは WinUI 3 の Release ページからダウンロードできるのだが、他のコンポーネントが混じっていて探すのが面倒。
Microsoft.UI.Xaml v2.8.6 が目的の場所になる。

1
$ Add-AppxPackage '.\Microsoft.UI.Xaml.2.8.x64.appx'

再度、WinGet のインストールを試みると同様のエラー。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
$ Add-AppxPackage '.\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle'
Add-AppxPackage : Deployment failed with HRESULT: 0x80073CF3, Package failed updates, dependency or conflict validation.
Windows cannot install package Microsoft.DesktopAppInstaller_1.23.1911.0_x64__8wekyb3d8bbwe because this package depends on a
framework that could not be found. Provide the framework "Microsoft.VCLibs.140.00.UWPDesktop" published by "CN=Microsoft
Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US", with neutral or x64 processor architecture and minimum version
14.0.30704.0, along with this package to install. The frameworks with name "Microsoft.VCLibs.140.00.UWPDesktop" currently installed
Windows cannot install package Microsoft.DesktopAppInstaller_1.23.1911.0_x64__8wekyb3d8bbwe because this package depends on a
framework that could not be found. Provide the framework "Microsoft.VCLibs.140.00.UWPDesktop" published by "CN=Microsoft
Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US", with neutral or x64 processor architecture and minimum version
14.0.30704.0, along with this package to install. The frameworks with name "Microsoft.VCLibs.140.00.UWPDesktop" currently installed
are: {}
NOTE: For additional information, look for [ActivityId] f367ae56-e5de-0000-5ae7-67f3dee5db01 in the Event Log or use the command
line Get-AppPackageLog -ActivityID f367ae56-e5de-0000-5ae7-67f3dee5db01
At line:1 char:1
+ Add-AppxPackage .\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbun ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : WriteError: (C:\Users\Admini...bbwe.msixbundle:String) [Add-AppxPackage], IOException
+ FullyQualifiedErrorId : DeploymentError,Microsoft.Windows.Appx.PackageManager.Commands.AddAppxPackageCommand

Microsoft.VCLibs.140.00.UWPDesktop のインストール

Microsoft.VCLibs.140.00.UWPDesktop 14.0.33728.0 がインストールされていないということなのでこれを公式から持ってくる。
こちらは How to install and update Desktop framework packages からダウンロードできるが、こちらのファイルは

The following package download links are now deprecated, and may no longer work in the future. Make sure to use the method described above to obtain the framework packages.

とあり、既に非推奨。
公式としては、 Visual Studio 2022 をインストールする際に、 Universal Windows Platform Development ワークロードに加え、 C++ (v143) Universal Windows Tools を追加することで %ProgramFiles(x86)%\Microsoft SDKs\Windows Kits\10\ExtensionSDKs\Microsoft.VCLibs.Desktop\14.0Retail 内に *.appx ファイルが含まれているので、それを使えばよいとのこと。

とはいえ、まずはこの非推奨の方法で進める。

1
2
$ Add-AppxPackage .\Microsoft.VCLibs.x64.14.00.Desktop.appx
$ Add-AppxPackage '.\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle'

インストールに成功する。

補足

もしここで、 1.8.1911 より新しい WinGet のパッケージをインストールしようとすると、下記の通りインストールされている Microsoft.VCLibs.140.00.UWPDesktop のバージョン (14.0.33321.0) と要求されるバージョン (14.0.33728.0) の不一致により依存関係の解決に失敗する。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
$ Add-AppxPackage .\Microsoft.VCLibs.x64.14.00.Desktop.appx
$ Add-AppxPackage '.\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle'
Add-AppxPackage : Deployment failed with HRESULT: 0x80073CF3, Package failed updates, dependency or conflict validation.
Windows cannot install package Microsoft.DesktopAppInstaller_1.26.400.0_x64__8wekyb3d8bbwe because this package depends on a
framework that could not be found. Provide the framework "Microsoft.VCLibs.140.00.UWPDesktop" published by "CN=Microsoft
Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US", with neutral or x64 processor architecture and minimum version
14.0.33728.0, along with this package to install. The frameworks with name "Microsoft.VCLibs.140.00.UWPDesktop" currently installed a
Windows cannot install package Microsoft.DesktopAppInstaller_1.26.400.0_x64__8wekyb3d8bbwe because this package depends on a
framework that could not be found. Provide the framework "Microsoft.VCLibs.140.00.UWPDesktop" published by "CN=Microsoft
Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US", with neutral or x64 processor architecture and minimum version
14.0.33728.0, along with this package to install. The frameworks with name "Microsoft.VCLibs.140.00.UWPDesktop" currently installed
are: {Microsoft.VCLibs.140.00.UWPDesktop_14.0.33321.0_x64__8wekyb3d8bbwe}
NOTE: For additional information, look for [ActivityId] 9b1603cc-e5a4-0000-828b-169ba4e5db01 in the Event Log or use the command
line Get-AppPackageLog -ActivityID 9b1603cc-e5a4-0000-828b-169ba4e5db01
At line:1 char:1
+ Add-AppxPackage '.\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbu ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : WriteError: (C:\Users\Admini...bbwe.msixbundle:String) [Add-AppxPackage], IOException
+ FullyQualifiedErrorId : DeploymentError,Microsoft.Windows.Appx.PackageManager.Commands.AddAppxPackageCommand

WinGet が起動しない

インストールに成功したのでバージョンを確認すると、なぜかエラーになる。

1
2
3
4
5
6
7
8
9
$ winget --version
Program 'winget.exe' failed to run: No applicable app licenses foundAt line:1 char:1
+ winget --version
+ ~~~~~~~~~~~~~~~~.
At line:1 char:1
+ winget --version
+ ~~~~~~~~~~~~~~~~
+ CategoryInfo : ResourceUnavailable: (:) [], ApplicationFailedException
+ FullyQualifiedErrorId : NativeCommandFailed

この問題は No applicable app licenses foundAt line:1 #700 として報告されており、 その中で

In the latest release of winget (v1.0.11692 - link here) Microsoft quietly included a license XML file. I just tried it out and was now able to install and run winget on Server 2022 Preview with:

として 1.0.11692 に含まれるライセンスファイルを指定してインストールすれば解決するとあるが、そんなことしなくても、 Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle をダブルクリックしてインストールし直すと解決する (そもそも、依存パッケージをインストールした後に、最初からダブルクリックでインストールすれば良い気もするが)。

install

Reinstall を選択。

install

Reinstall を選択。

install

閉じる。
再度バージョンを確認。

1
2
$ winget --version
v1.8.1911

WinGet を最新版に

古いバージョンをインストールしたのでアップデートを行う。
依存関係も含めて全部更新する。

1
2
3
$ winget upgrade --all
$ winget --version
v1.11.400

動くことを確認

1
2
3
4
5
6
7
8
9
10
$ winget install Microsoft.WinDbg
Found WinDbg [Microsoft.WinDbg] Version 1.2502.25002.0
This application is licensed to you by its owner.
Microsoft is not responsible for, nor does it grant any licenses to, third-party packages.
Downloading https://windbg.download.prss.microsoft.com/dbazure/prod/1-2502-25002-0/windbg.msixbundle
██████████████████████████████ 694 MB / 694 MB
Successfully verified installer hash
Starting package install...
██████████████████████████████ 100%
Successfully installed

windbg