Files
winget-pkgs/doc/tools/SandboxTest.md

3.7 KiB

Using SandboxTest.ps1

The SandboxTest.ps1 script allows you to test manifests locally using the Windows Sandbox without installing the application directly on your system.

Prerequisites

  1. Fork and Clone the Repository

  2. Enable Windows Sandbox Ensure Windows Sandbox is enabled. Run the following command in PowerShell:

    Enable-WindowsOptionalFeature -FeatureName "Containers-DisposableClientVM" -All -Online
    

    Restart your computer after the command completes.

System Requirements

  • Windows 10 or 11 Pro, Enterprise, or Education (build 18305 or later); Windows Sandbox is not supported on Windows Home edition
  • AMD64 architecture
  • Virtualization enabled in BIOS
  • At least 4 GB of RAM, 1 GB of free disk space, and two CPU cores

Usage

Open a PowerShell terminal and navigate to the Tools folder:

cd <drive>\<path-to-parent>\winget-pkgs\Tools

Run the script with the full path to the manifest as an argument. This validates the manifest, opens Windows Sandbox, and attempts to install the package.

.\SandboxTest.ps1 <path-to-manifest> [<options>]

Supported Options

Argument Description
-Manifest Path to the manifest to install in the Sandbox
-Script Post-installation script to run in the Sandbox
-MapFolder Folder to map in Sandbox (default: current directory)
-WinGetVersion Specify the version of WinGet to use in Sandbox
-WinGetOptions Additional options for the winget install command
-SkipManifestValidation Skip winget validate -m <manifest> if already validated
-Prerelease Use preview release versions of WinGet
-EnableExperimentalFeatures Enable WinGet experimental features
-Clean Force re-download of WinGet and dependencies

Important

The -GitHubToken option has been removed. Use the WINGET_PKGS_GITHUB_TOKEN environment variable instead.


Examples

Test a Manifest with the Latest Stable WinGet

.\SandboxTest.ps1 <path-to-manifest>

Test a Manifest with the Latest Preview WinGet

.\SandboxTest.ps1 <path-to-manifest> -Prerelease

Test a Manifest with a Specific WinGet Version

.\SandboxTest.ps1 <path-to-manifest> -WinGetVersion 1.10.340 -Prerelease -Script {Write-Host 'Script finished'}

Install a Package from the Repository in Sandbox

.\SandboxTest.ps1 -WinGetVersion 1.9 -Script {winget install <PackageIdentifier> --accept-source-agreements}

Integration with Other Scripts

  • YamlCreate Script: Uses SandboxTest.ps1 to test newly created manifests.
  • PRTest Script: Depends on SandboxTest.ps1 to validate manifests submitted in pull requests.