Building the snap on Windows

Now that you have a snapcraft.yaml describing how to assemble your app and dependencies, you can build a snap.

The Microsoft Store contains an installable (WSL) Windows Subsystem for Linux containing Ubuntu 16.04.2. Once installed, users can run some Linux binaries under Windows.

Snapcraft, the command-line tool for building snaps, is distributed in the Ubuntu repository, which is accesible under WSL. Be sure to install WSL, choosing Ubuntu before continuing.

Once installed, run WSL from the Windows Start menu.

Next, install snapcraft:

sudo apt install snapcraft

Navigate to the project directory on your Windows host where the snapcraft.yaml file exists and run snapcraft.

snapcraft

If the snap build completes successfully, you will find a .snap file in the same directory that you ran the snapcraft command. You can inspect its contents to ensure it contains all of your application’s assets:

unsquashfs -l *.snap

Next steps

Continue on to learn how to install, test, and publish your snap file.

1 Like

Oh boy, if this were possible… actually universal packaging incoming? :scream::scream:

Hi,
than it’s possible to build snap on WSL, but it’s impossible to use it to install snaps. Is it right?

Thank you

1 Like

Yes. That is correct.

Note that you must build the snap “by hand” as snapcraft itself is distribited as a snap and often requires multipass, another snap, for virtualization. You should be able to use snapcraft natively on windows eventually but I don’t know the status of that. Note that natively means without WSL

Is this still meant to be possible? I can’t seem to get either LXD nor Multipass to work in WSL so snapcraft also fails. Which driver is Multipass meant to be set with?

I believe as of WSL2 snapd and LXD both can be run with a custom kernel.