WinGetCreate 实用工具安装及清单创建选项,还有 YAMLCreate.ps1 脚本助力

winget install wingetcreate

WinGetCreate真的很棒!它能帮助你把电脑里所有软件的信息归纳好放在Windows的应用商店里。是不是感觉有些绕?其实就是说,用了它以后找软件信息就更方便啦~

"对头!选'是',WinGetCreate就能帮你在Windows应用商店上发个PR。这样一来,大家都能看见你的软件,下载也更容易了哦~"

YAMLCreate.ps1脚本的作用

别怕,Windows自带了个叫YAMLCreate.ps1的好用PowerShell工具。在应用商店就能找到这个小助手,它能帮你快速管理清单文件~

这个真的很棒!直接用它复制电脑就行了。就在"工具"那个文件夹里找到它就能用。就是给大家找了个方便的帮手。

YAML格式的优势

你问我为什么要用YAML来创建程序包清单?那是因为它简单易懂,和微软的其他开发工具也很搭!这样不管是开发人员还是普通用户都能轻松看懂清单文件。

虽然Windows的糊软管家里还没塞满YAML的功能,但是已经有不少实用的安装项目可供选择了,大大简化了我们装软件的过程,真的挺好用的。感觉就像是有个小助手在旁边教你怎么做,特别得心应手。

清单文件的规范

PackageIdentifier:  # Publisher.package format.
PackageVersion:     # Version numbering format.
PackageLocale:      # BCP 47 format (e.g. en-US)
Publisher:          # The name of the publisher.
PackageName:        # The name of the application.
License:            # The license of the application.
ShortDescription:   # The description of the application.
Installers: 
 - Architecture:    # Enumeration of supported architectures.
   InstallerType:   # Enumeration of supported installer types (exe, msi, msix, inno, wix, nullsoft, appx).
   InstallerUrl:    # Path to download installation file.
   InstallerSha256: # SHA256 calculated from installer.
ManifestType:       # The manifest file type
ManifestVersion: 1.6.0

表格里别忘了用大写字母,也别重复!这样才能让清单清晰明了,大家都能按这个规则来操作和查看。

PackageIdentifier: Microsoft.WindowsTerminal
PackageVersion: 1.6.10571.0
PackageLocale: en-US
Publisher: Microsoft
PackageName: Windows Terminal
License: MIT
ShortDescription: The new Windows Terminal, a tabbed command line experience for Windows.
Installers: 
 - Architecture: x64
   InstallerType: msix
   InstallerUrl: https://github.com/microsoft/terminal/releases/download/v1.6.10571.0/Microsoft.WindowsTerminal_1.6.10571.0_8wekyb3d8bbwe.msixbundle
   InstallerSha256: 092aa89b1881e058d31b1a8d88f31bb298b5810afbba25c5cb341cfa4904d843
   SignatureSha256: e53f48473621390c8243ada6345826af7c713cf1f4bbbf0d030599d1e4c175ee
ManifestType: singleton
ManifestVersion: 1.6.0

想一口气看完所有清单?那就去瞧瞧Windows应用商店的清单规则!就像有个老师手把手教你完成任务,每个步骤都讲得清清楚楚。

单一实例格式与多文件格式

PackageIdentifier: "Microsoft.WindowsTerminal"
PackageVersion: "1.6.10571.0"
DefaultLocale: "en-US"
ManifestType: "version"
ManifestVersion: "1.6.0"

软件只要按一次,换个地儿就能搞定的话,用个安装包,就选单一实例格式。不过,如果你得装好几个版本或者改好几个地方,那就得用上N多YAML文件和那个框架咯。

这样一来,我们是不是就可以把软件和本地化资料分头处理?这不就是你平时整理文件也会看实际需求!

PackageIdentifier: "Microsoft.WindowsTerminal"
PackageVersion: "1.6.10571.0"
PackageLocale: "en-US"
Publisher: "Microsoft"
PublisherUrl: "https://www.microsoft.com/"
PrivacyUrl: "https://privacy.microsoft.com/"
PackageName: "Windows Terminal"
PackageUrl: "https://learn.microsoft.com/windows/terminal/"
License: "MIT"
LicenseUrl: "https://github.com/microsoft/terminal/blob/master/LICENSE"
ShortDescription: "The new Windows Terminal, a tabbed command line experience for Windows."
Tags: 
- "Console"
- "Command-Line"
- "Shell"
- "Command-Prompt"
- "PowerShell"
- "WSL"
- "Developer-Tools"
- "Utilities"
- "cli"
- "cmd"
- "ps"
- "terminal"
ManifestType: "defaultLocale"
ManifestVersion: "1.6.0"

show命令与默认区域设置

PackageIdentifier: "Microsoft.WindowsTerminal"
PackageVersion: "1.6.10571.0"
PackageLocale: "fr-FR"
Publisher: "Microsoft"
ShortDescription: "Le nouveau terminal Windows, une expérience de ligne de commande à onglets pour Windows."
ManifestType: "locale"
ManifestVersion: "1.6.0"

显示提示时,其他地方没设必填项的话,就用默认值哈。这样大家看软件资料时能大概知道啥意思了!

PackageIdentifier: "Microsoft.WindowsTerminal"
PackageVersion: "1.6.10571.0"
Platform: 
 - "Windows.Desktop"
MinimumOSVersion: "10.0.18362.0"
InstallerType: "msix"
InstallModes: 
 - "silent"
PackageFamilyName: "Microsoft.WindowsTerminal_8wekyb3d8bbwe"
Installers: 
 - Architecture: "x64"
   InstallerUrl: "https://github.com/microsoft/terminal/releases/download/v1.6.10571.0/Microsoft.WindowsTerminal_1.6.10571.0_8wekyb3d8bbwe.msixbundle"
   InstallerSha256: 092aa89b1881e058d31b1a8d88f31bb298b5810afbba25c5cb341cfa4904d843
   SignatureSha256: e53f48473621390c8243ada6345826af7c713cf1f4bbbf0d030599d1e4c175ee
 - Architecture: "arm64"
   InstallerUrl: "https://github.com/microsoft/terminal/releases/download/v1.6.10571.0/Microsoft.WindowsTerminal_1.6.10571.0_8wekyb3d8bbwe.msixbundle"
   InstallerSha256: 092aa89b1881e058d31b1a8d88f31bb298b5810afbba25c5cb341cfa4904d843
   SignatureSha256: e53f48473621390c8243ada6345826af7c713cf1f4bbbf0d030599d1e4c175ee
 - Architecture: "x86"
   InstallerUrl: "https://github.com/microsoft/terminal/releases/download/v1.6.10571.0/Microsoft.WindowsTerminal_1.6.10571.0_8wekyb3d8bbwe.msixbundle"
   InstallerSha256: 092aa89b1881e058d31b1a8d88f31bb298b5810afbba25c5cb341cfa4904d843
   SignatureSha256: e53f48473621390c8243ada6345826af7c713cf1f4bbbf0d030599d1e4c175ee
ManifestType: "installer"
ManifestVersion: "1.6.0"

只要你是用Nullsoft或Inno做的EXE安装程序,那就简单,直接把选项设成'无'就好。这样用户在安装时就能自动选择'无'了。

THE END