How CodeStream uses Windows Sandbox to test new user flow with Visual Studio Code

Brian CanzanellaBrian Canzanella
March 4, 2021

Windows sandbox is a lightweight desktop environment used to run applications in isolation. Here at TeamCodeStream, we love using it because it can help create the environment needed for simulating the experience of a new user. We can pretend we’re installing CodeStream for the first time (again)!

For details on setting up Windows Sandbox for the first time, you can checkout this doc.


Below is an example configuration file for Windows sandbox. Notice that it contains a `LogonCommand`, this is how we can make our lives a little easier by running a few things automatically when the instance starts. Your .wsb file is just a configuration file that the sandbox can use to startup up. Here’s what CodeStream.wsb looks like when opened in a text editor:

CodeStream.wsb

<Configuration>
<MappedFolders>    
  <MappedFolder> 	
    <HostFolder>C:\SandboxScripts</HostFolder>
    <ReadOnly>true</ReadOnly>   
  </MappedFolder>
</MappedFolders>
<LogonCommand>    
  <Command>C:\users\wdagutilityaccount\desktop\SandboxScripts\Install.cmd</Command>
</LogonCommand>
</Configuration>


CodeStream for VS Code has a few dependencies, including git as well as VS Code (of course), so we can have the script get and install those for us.

Install.cmd

REM Download VSCode and put it on the desktop
curl -L "https://update.code.visualstudio.com/latest/win32-x64-user/stable" --output C:\users\WDAGUtilityAccount\Desktop\vscode-installer.exe

REM Download Git for Windows
curl -L "https://github.com/git-for-windows/git/releases/download/v2.25.0.windows.1/Git-2.25.0-64-bit.exe" --output C:\users\WDAGUtilityAccount\Desktop\git.exe

C:\Users\WDAGUtilityAccount\Desktop\vscode-installer.exe /VERYSILENT /NORESTART /MERGETASKS=!runcode

REM Install and run Git
C:\users\WDAGUtilityAccount\Desktop\git.exe /VERYSILENT 

START /WAIT code


We can get a fresh copy of VS Code without any extensions and without any changes to settings in the IDE or at the operating system level. When we’re developing a new version of the extension we can drop a built .vsix file in C:\SandboxScripts on the host machine and load it from there, or if we need to check something in production, we can grab it right from in-IDE.


Above is what CodeStream looks like in a new, clean environment, all ready for a new user to signup!

As always thanks for reading! CodeStream is available for VS Code, JetBrains, Visual Studio, and Atom. And by the way, CodeStream is open source, so fork our repo and tell us what we broke! ;)


Discuss

Please share your thoughts and feedback @teamcodestream.

About CodeStream

CodeStream integrates all of your essential dev tools, such as GitHub, GitLab, Bitbucket, Slack, Teams, Jira, Trello and more, into VS Code, Visual Studio, and any JetBrains IDE.

Thank you for your interest in CodeStream.

We'll be in touch shortly.
Oops! Something went wrong while submitting the form.
CodeStream Demo Time

During our daily stand-ups we demo features in development to allow everyone, which now includes you too, to stay in the loop and provide early feedback.

Recent Blog Posts

Two Ways to See for Yourself