Delen via


Een CLI-uitvoerbaar bestand verpakken als MSIX

Deze handleiding begeleidt u bij het verpakken van een bestaand uitvoerbaar opdrachtregelprogramma als EEN MSIX-pakket voor distributie via Windows Package Manager (winget), de Microsoft Store of directe distributie.

Vereiste voorwaarden

  • Een bestaand uitvoerbaar CLI-bestand (.exe) dat u wilt verpakken
  • Windows 10 versie 1809 of hoger

Steps

1. Uw CLI-toepassing organiseren

Plaats het uitvoerbare CLI-bestand en eventuele afhankelijkheden in een toegewezen map:

mkdir MyCliPackage
cd MyCliPackage
# Copy your CLI executable and dependencies here

2. Winapp CLI installeren

winget install microsoft.winappcli --source winget

3. Genereer de appxmanifest.xml

winapp manifest generate --executable .\yourcli.exe

Hiermee maakt u een appxmanifest.xml bestand met standaardwaarden die zijn ingevuld op basis van het uitvoerbare bestand.

4. Het manifest configureren

Bewerk de gegenereerde appxmanifest.xml bewerkingsalias om een uitvoeringsalias toe te voegen, verberg de app in het menu Start en werk de toepassingsgegevens bij.

4.1 Vereiste naamruimte toevoegen

Voeg de uap5 naamruimte toe aan het Package element:

<Package
  xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
  ...
  xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
  xmlns:uap5="http://schemas.microsoft.com/appx/manifest/uap/windows10/5"
  xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
  IgnorableNamespaces="uap uap5 rescap">

4.2 Verbergen in menu Start

Voeg in het <uap:VisualElements> element het volgende toe AppListEntry="none":

<uap:VisualElements
    DisplayName="YourApp"
    Description="My Application"
    BackgroundColor="transparent"
    Square150x150Logo="Assets\Square150x150Logo.png"
    Square44x44Logo="Assets\Square44x44Logo.png"
    AppListEntry="none">
</uap:VisualElements>

4.3 Uitvoeringsalias toevoegen

Voeg de extensie toe binnen het <Application> element:

<Extensions>
  <uap5:Extension Category="windows.appExecutionAlias">
    <uap5:AppExecutionAlias>
      <uap5:ExecutionAlias Alias="yourcli.exe" />
    </uap5:AppExecutionAlias>
  </uap5:Extension>
</Extensions>

Vervang door yourcli.exe de gewenste opdrachtnaam voor uw CLI.

4.4 Metagegevens van toepassing bijwerken

Werk de Identitysecties en PropertiesVisualElementssecties bij zodat deze overeenkomen met uw CLI-toepassing.

5. Genereer een ontwikkelingscertificaat (optioneel)

Voor lokale tests en distributie buiten de Microsoft Store:

cd ~
winapp cert generate
winapp cert install

Belangrijk

Bewaar uw ontwikkelingscertificaat buiten de map met het uitvoerbare CLI-bestand om te voorkomen dat het per ongeluk in het pakket wordt opgenomen.

6. Uw CLI verpakken

winapp pack .\MyCliPackage --cert path\to\devcert.pfx

Hiermee maakt u een .msix bestand in de huidige map.

Aanbeveling

  • De Microsoft Store ondertekent de MSIX voor u. U hoeft de MSIX niet te ondertekenen voordat u deze inzendt.
  • Mogelijk hebt u afzonderlijke MSIX-pakketten nodig voor elke architectuur die u ondersteunt (x64, Arm64).