Test your Windows Package Manager manifests with Windows Sandbox

Join me as I look at how you can use Windows Sandbox to test out your Windows Package Manager manifests!

Test your Windows Package Manager manifests with Windows Sandbox
Test your Windows Package Manager manifests with Windows Sandbox

The other week I wrote about contributing to Windows Package Manager and creating manifests to help build up the repository of software that could be installed via it.

I talked about part of the process being that you should test your manifest before submitting it to the repository for review.

I want to talk a bit more about that and how you can take advantage of Windows Sandbox to test your manifests.

Windows Sandbox

Windows Sandbox is a Hyper-V piece of technology that allows you to spin up an isolated, temporary desktop environment you can run tests on, demos on or use if you are unsure about a bit of software.

You can spin up a Windows Sandbox environment and when you close that Sandbox all the software with all it's files and state are permanently deleted.

If you haven't already tried it out, check out my blog post on installing it.

Windows Package Manager and Windows Sandbox

When you launch the Windows Sandbox, it comes up the minimal installed on it.  So if you want to use anything within it you need install it and build up that environment.

The Windows Package Manager team have put together a handy PowerShell script that spins up a Windows Sandbox session with Windows Package Manager already installed so you can get started with your testing straight away.

To make use of this script you first need to have Windows Sandbox installed and then you take a copy of the script and run it within a PowerShell session.

Windows Sandbox with Windows Package Manager install setup
Windows Sandbox with Windows Package Manager install setup

The script will check that you have Windows Sandbox installed and if you don't then it will stop running.

It will also check you don't already have any Windows Sandbox sessions open and if it does find one it will close it.

It will then start to download Windows Package Manager in the background and start to create the Window Sandbox configuration file and then finally launch that Window Sandbox session.

This should only take a few moments.

Windows Sandbox session with Windows Package Manager installed
Windows Sandbox session with Windows Package Manager installed

Now what?

You now have a test environment where you can test your Windows Package Manager Manifest files work as you want them without destroying your own machine.  

And if something goes wrong within the Sandbox you can easily close it off, and then start again with a fresh session.

Let me know how you get on with Windows Package Manager and Windows Sandbox. And I'd love to hear other use cases for the Windows Sandbox. 👍

Learn more!

If you want to learn more about Windows Package Manager and see a complete overview of it's features, be sure to check out the Microsoft Learn module - Explore the Windows Package Manager Tool.