### Example App Installer File
Source: https://github.com/microsoftdocs/msix-docs/blob/main/msix-src/app-installer/how-to-create-appinstaller-file.md
This XML file defines a related set of packages, including a main bundle and optional packages, along with update and repair URIs and update settings.
```xml
http://mywebservice.azurewebsites.net/appset.appinstaller
http://mywebservice2.azurewebsites.net/appset.appinstaller
http://mywebservice.azurewebsites.net/appset.appinstaller
http://mywebservice2.azurewebsites.net/appset.appinstaller
```
--------------------------------
### Key file example
Source: https://github.com/microsoftdocs/msix-docs/blob/main/msix-src/package/create-app-package-with-makeappx-tool.md
This is an example of a key file format used for encrypting or decrypting packages. It must start with '[Keys]' followed by base64 encoded key ID and encryption key pairs.
```Example
[Keys]
"OWVwSzliRGY1VWt1ODk4N1Q4R2Vqc04zMzIzNnlUREU=" "MjNFTlFhZGRGZEY2YnVxMTBocjd6THdOdk9pZkpvelc="
```
--------------------------------
### Start MSIX Tracing
Source: https://github.com/microsoftdocs/msix-docs/blob/main/msix-src/msix-core/msixcore-troubleshoot.md
Use this command to start the MSIX tracing script and begin capturing installation logs. The script will prompt for further actions.
```PowerShell
msixtrace.ps1 -start
```
--------------------------------
### Handle protocol activation with installation parameters in C#
Source: https://github.com/microsoftdocs/msix-docs/blob/main/msix-src/app-installer/install-parameters.md
Implement code to handle installation parameters passed to your app during protocol activation. This example uses AppInstance.GetActivatedEventArgs to determine the activation type and extracts parameters from the URI if it's a protocol activation.
```csharp
using Windows.ApplicationModel;
using Windows.ApplicationModel.Activation;
public static void Main(string[] cmdArgs)
{
var activationArgs = AppInstance.GetActivatedEventArgs();
switch (activationArgs.Kind)
{
//Install parameters will be passed in during a protocol activation
case ActivationKind.Protocol:
HandleProtocolActivation(activationArgs as ProtocolActivatedEventArgs);
break;
case ActivationKind.Launch:
//Regular launch activation type
HandleLaunch(activationArgs as LaunchActivatedEventArgs);
break;
default:
break;
}
static void HandleProtocolActivation(ProtocolActivatedEventArgs args)
{
if (args.Uri != null)
{
//Handle the installation parameters in the protocol uri
handleInstallParameter(args.Uri.ToString());
}
}
}
```
--------------------------------
### MakeAppx pack command examples
Source: https://github.com/microsoftdocs/msix-docs/blob/main/msix-src/package/create-app-package-with-makeappx-tool.md
These examples illustrate practical usage of the MakeAppx pack command, including options for verbosity, hash algorithm, content directory, output package name, and encryption.
```examples
MakeAppx pack /v /h SHA256 /d "C:\My Files" /p MyPackage.msix
```
```examples
MakeAppx pack /v /o /f MyMapping.txt /p MyPackage.msix
```
```examples
MakeAppx pack /m "MyApp\AppxManifest.xml" /f MyMapping.txt /p AppPackage.msix
```
```examples
MakeAppx pack /r /m "MyApp\AppxManifest.xml" /f MyMapping.txt /p ResourcePackage.msix
```
```examples
MakeAppx pack /v /h SHA256 /d "C:\My Files" /ep MyPackage.emsix /kf MyKeyFile.txt
```
```examples
MakeAppx pack /v /h SHA256 /d "C:\My Files" /ep MyPackage.emsix /kt
```
--------------------------------
### Check for, download, and install app updates
Source: https://github.com/microsoftdocs/msix-docs/blob/main/msix-src/store-developer-package-update.md
Use this method to let the system handle checking for updates, downloading them, and then prompting the user for installation. The result of the user's choice (install now or defer) is returned.
```csharp
using Windows.Services.Store;
private async void GetEasyUpdates()
{
StoreContext updateManager = StoreContext.GetDefault();
IReadOnlyList updates = await updateManager.GetAppAndOptionalStorePackageUpdatesAsync();
if (updates.Count > 0)
{
IAsyncOperationWithProgress downloadOperation =
updateManager.RequestDownloadAndInstallStorePackageUpdatesAsync(updates);
StorePackageUpdateResult result = await downloadOperation.AsTask();
}
}
```
--------------------------------
### Install App Link with ms-appinstaller Protocol
Source: https://github.com/microsoftdocs/msix-docs/blob/main/msix-src/desktop/azure-dev-ops.md
An example of an HTML anchor tag that uses the ms-appinstaller protocol. Clicking this link allows users to directly install the app from a web server without downloading the MSIX package first, provided the server is configured correctly and supports byte-range requests.
```html
Install App
```
--------------------------------
### Examples for unpacking and unbundling
Source: https://github.com/microsoftdocs/msix-docs/blob/main/msix-src/package/create-app-package-with-makeappx-tool.md
These examples demonstrate how to unpack and unbundle MSIX packages and bundles, including encrypted ones using key files or the global test key.
```examples
MakeAppx unpack /v /p MyPackage.msix /d "C:\My Files"
```
```examples
MakeAppx unpack /v /ep MyPackage.emsix /d "C:\My Files" /kf MyKeyFile.txt
```
```examples
MakeAppx unpack /v /ep MyPackage.emsix /d "C:\My Files" /kt
```
```examples
MakeAppx unbundle /v /p MyBundle.msixbundle /d "C:\My Files"
```
```examples
MakeAppx unbundle /v /ep MyBundle.emsixbundle /d "C:\My Files" /kf MyKeyFile.txt
```
```examples
MakeAppx unbundle /v /ep MyBundle.emsixbundle /d "C:\My Files" /kt
```
--------------------------------
### MakeAppx bundle command examples
Source: https://github.com/microsoftdocs/msix-docs/blob/main/msix-src/package/create-app-package-with-makeappx-tool.md
These examples demonstrate practical usage of the MakeAppx bundle command for creating app bundles, including options for verbosity, content directory, output bundle name, bundle version, and encryption.
```examples
MakeAppx bundle /v /d "C:\My Files" /p MyBundle.msixbundle
```
```examples
MakeAppx bundle /v /o /bv 1.0.1.2096 /f MyMapping.txt /p MyBundle.msixbundle
```
```examples
MakeAppx bundle /v /o /bv 1.0.1.2096 /f MyMapping.txt /ep MyBundle.emsixbundle /kf MyKeyFile.txt
```
```examples
MakeAppx bundle /v /o /bv 1.0.1.2096 /f MyMapping.txt /ep MyBundle.emsixbundle /kt
```
--------------------------------
### Examples for encrypting and decrypting
Source: https://github.com/microsoftdocs/msix-docs/blob/main/msix-src/package/create-app-package-with-makeappx-tool.md
These examples demonstrate how to encrypt and decrypt MSIX packages using either a key file or the global test key.
```examples
MakeAppx.exe encrypt /p MyPackage.msix /ep MyEncryptedPackage.emsix /kt
```
```examples
MakeAppx.exe encrypt /p MyPackage.msix /ep MyEncryptedPackage.emsix /kf MyKeyFile.txt
```
```examples
MakeAppx.exe decrypt /p MyPackage.msix /ep MyEncryptedPackage.emsix /kt
```
```examples
MakeAppx.exe decrypt p MyPackage.msix /ep MyEncryptedPackage.emsix /kf MyKeyFile.txt
```
--------------------------------
### Completed config.json Example
Source: https://github.com/microsoftdocs/msix-docs/blob/main/msix-src/psf/psf-launch-apps-with-parameters.md
This is a fully configured `config.json` example, demonstrating how to map the `Id`, `Executable`, and `arguments` from the `AppxManifest.xml` and recorded launch parameters.
```json
{
"applications": [
{
"id": "PSFSample",
"executable": "VFS/ProgramFilesX64/PS Sample App/PSFSample.exe",
"arguments": "/bootfromsettingshortcut"
}
]
}
```
--------------------------------
### Install AzureSignTool .NET Global Tool
Source: https://github.com/microsoftdocs/msix-docs/blob/main/msix-src/desktop/cicd-keyvault.md
Install the AzureSignTool as a .NET global tool. Ensure you have the latest .NET SDK installed.
```bash
dotnet tool install --global AzureSignTool
```
--------------------------------
### Configure App Installer with Update URIs
Source: https://github.com/microsoftdocs/msix-docs/blob/main/msix-src/app-installer/how-to-create-appinstaller-file.md
This example demonstrates how to specify fallback update URIs in your App Installer file. These URIs are used if the primary App Installer URI becomes inaccessible. A maximum of 10 URIs can be configured. This requires schema version 2021 or newer.
```xml
https://www.contoso.com/Installers/MainApp.AppInstaller
\\ServerName\Share\Installers\MainApp.AppInstaller
```
--------------------------------
### Install MSIX Packaging Tool with WinGet
Source: https://github.com/microsoftdocs/msix-docs/blob/main/msix-src/packaging-tool/tool-overview.md
Use the WinGet command-line tool to install the MSIX Packaging Tool.
```powershell
PS C:\> winget install "MSIX Packaging Tool"
```
--------------------------------
### Example config.json with Values
Source: https://github.com/microsoftdocs/msix-docs/blob/main/msix-src/psf/package-support-framework-vs.md
This example shows a populated config.json file with sample values for applications, processes, and fixups. Ensure your values align with your project's structure and needs.
```json
{
"applications": [
{
"id": "DesktopApplication",
"executable": "DesktopApplication/WinFormsDesktopApplication.exe",
"workingDirectory": "WinFormsDesktopApplication"
}
],
"processes": [
{
"executable": ".*App.*",
"fixups": [ { "dll": "RuntimeFix.dll" } ]
}
]
}
```
--------------------------------
### Create HTML link for App Installer
Source: https://github.com/microsoftdocs/msix-docs/blob/main/msix-src/app-installer/web-install-azure.md
Use this HTML code to create a link that invokes the App Installer protocol for installing an MSIX bundle. Ensure the `source` URL points to your app package hosted on Azure.
```html
Install My Sample App
Install My Sample App
```
--------------------------------
### HTML for App Installation Links
Source: https://github.com/microsoftdocs/msix-docs/blob/main/msix-src/app-installer/installing-windows10-apps-web.md
Use this HTML structure to create links that launch the App Installer for your app packages. Ensure your URIs are prefixed with 'ms-appinstaller:?source='.
```html
MyApp Web Page
Install app package
Install app bundle
Install related set
```
--------------------------------
### Install Package Support Framework using NuGet
Source: https://github.com/microsoftdocs/msix-docs/blob/main/msix-src/psf/psf-current-working-directory.md
Installs the Microsoft.PackageSupportFramework using the NuGet CLI. Ensure you are running this from an Administrative PowerShell window.
```PowerShell
Set-Location "C:\PSF"
.
uget\nuget.exe install Microsoft.PackageSupportFramework
```
--------------------------------
### Install MSIX with Dependencies
Source: https://github.com/microsoftdocs/msix-docs/blob/main/msix-src/desktop/managing-your-msix-deployment-troubleshooting.md
Use this command to install an MSIX package along with its dependency packages. Ensure all dependency files are available.
```powershell
Add-AppxPackage main.msix -DependencyPath dep1.msix, dep2.msix
```
--------------------------------
### Install Package Support Framework via NuGet CLI
Source: https://github.com/microsoftdocs/msix-docs/blob/main/msix-src/psf/package-support-framework.md
Install the Microsoft.PackageSupport.Framework NuGet package using the command line tool. This provides the necessary PSF files for your project.
```powershell
nuget install Microsoft.PackageSupportFramework
```
--------------------------------
### Install the MSIX package with PowerShell
Source: https://github.com/microsoftdocs/msix-docs/blob/main/msix-src/psf/package-support-framework.md
Installs the signed MSIX package onto the system. Ensure the package is uninstalled first if it already exists.
```powershell
powershell Add-AppPackage .\PSFSamplePackageFixup.msix
```
--------------------------------
### Install Windows SDK in GitHub Actions
Source: https://github.com/microsoftdocs/msix-docs/blob/main/msix-src/msix-troubleshooting-guide.md
Installs the Windows SDK using winget in a GitHub Actions CI/CD pipeline to resolve 'signtool' not found errors.
```yaml
- name: Install Windows SDK
run: |
winget install --id Microsoft.WindowsSDK.10.0.22621 --accept-source-agreements --accept-package-agreements
```
--------------------------------
### Install downloaded app updates
Source: https://github.com/microsoftdocs/msix-docs/blob/main/msix-src/store-developer-package-update.md
This code snippet demonstrates how to initiate the installation of previously downloaded updates. It's important to save the app's state before calling this, as the app may terminate after the update is applied.
```csharp
private async void InstallUpdatesAsync()
{
StoreContext updateManager = StoreContext.GetDefault();
IReadOnlyList updates = await updateManager.GetAppAndOptionalStorePackageUpdatesAsync();
// Save app state here
IAsyncOperationWithProgress installOperation =
updateManager.RequestDownloadAndInstallStorePackageUpdatesAsync(updates);
StorePackageUpdateResult result = await installOperation.AsTask();
// Under normal circumstances, app will terminate here
// Handle error cases here using StorePackageUpdateResult from above
}
```
--------------------------------
### SignTool Internal Error Example
Source: https://github.com/microsoftdocs/msix-docs/blob/main/msix-src/package/signing-known-issues.md
This is an example of an unexpected internal error that can occur when using SignTool. Error codes starting with 0x8008 indicate an invalid package.
```syntax
SignTool Error: An unexpected internal error has occurred.
Error information: "Error: SignerSign() failed." (-2147024885 / 0x8007000B)
```
--------------------------------
### MakeAppx bundle command syntax options
Source: https://github.com/microsoftdocs/msix-docs/blob/main/msix-src/package/create-app-package-with-makeappx-tool.md
These examples show the basic syntax for the MakeAppx bundle command, demonstrating how to create app bundles using content directories or mapping files, with options for encryption.
```syntax
MakeAppx bundle [options] /d /p