Visual Studio Code in PortableApps.com format (unofficial). Can possibly be applied to VSCodium too.
Why do I need it if Visual Studio Code already support native portable mode?
Native portable mode can still leave some traces on the system and registry (created by extensions and development environments). Moreover, you still need to add your (portable) development environments to PATH
manually and sometimes, this process is tiring, especially if you want to set them up on multiple computers or need to change the PATH
oftenly.
With VSCodePortable, you can just pack your development environments together (along with VSCodePortable), copy them to flash drive, and run them again on different computer without needing to set up them again (see below for more details).
- All known traces (on the system and registry) will be removed automatically after run. Including some traces left by extensions and development environments. Check
VSCodePortable.ini
andCustom.nsh
file inApp\AppInfo\Launcher
folder for more details. - Support some popular development environments (see below), they will be added to
PATH
automatically during runtime. Only affectsCode.exe
and processes run by it, your realPATH
environment variable will stay untouched. You can specify their location by modifyingVSCodePortable.ini
file in root directory (appears only after the first run). - Added context menu items (e.g.
Open with Code
) just like the non-portable version. Will be removed automatically after you close Visual Studio Code (please don't shut down your system directly, close VSCodePortable first). - Can auto-install VSIX files located in
App\FirstRun\VSCode\extensions
folder on first run. Be aware that some extensions require other extension as dependency, you can add number in front of the file name because they will be installed in descending order. - Disabled telemetry and auto-update (via
settings.json
)
What are the differences between this and Gareth Flower's vscode-portable?
As far as I know, Flower's version has similar behavior compared to native portable mode. My version has some extra features that I needed personally (as stated above).
VSCodium is not allowed to use any proprietary debugging tools made by Microsoft, including those that are embedded on extensions like C/C++ extension, and many more. It seems that there is workaround, but I don't have a clean way to modify and support it right now (feel free to open PR). Moreover, some extensions still doesn't work properly even after using that patch.
It supports Git, MinGW (GCC), Python, Java, Node.js, Go, Rust, Flutter, Android Studio, Android SDK, Apache Spark, and PlatformIO. Visual Studio build tools support is also (partially) supported, see my other repo (BuildToolsInspector). You can enable optional modification(s) for each DE via VSCodePortable.ini
(on the launcher root directory).
When updating VSCodePortable from the release page, please compare the previously mentioned file with App\FirstRun\VSCodePortable.ini
in case I added support for new feature(s), since the existing config file will not be replaced automatically. Sorry for the inconvenience.
Open an issue or pull request and I will see what I can do.
- Download the latest release of VSCodePortable
- Extract it anywhere (e.g.
D:\Apps\VSCodePortable
), but avoid using very long path - Download Visual Studio Code (
.zip
format) from here - Extract it to
D:\Apps\VSCodePortable\App\VSCode
- Done, always start Visual Studio Code by using
VSCodePortable.exe
Note: If you're using the portable installer from release page (.exe
, not .zip
), step 2-5 are unnecessary since the latest version of VSCode will be downloaded automatically.
Required to be able to recognize your (portable) development environments.
- Open
VSCodePortable.exe
at least once - Navigate to
D:\Apps\VSCodePortable
(or wherever your install directory is) - Open
VSCodePortable.ini
by using any text editor - Look out for
[Environment]
section and change the values (GIT
,MINGW
,PYTHON
, etc) to real path where your development environment exist (please don't point tobin
folder directly, just the root folder). If the folder/path doesn't exist, it will simply be ignored - Done, if you change it to the right path, Visual Studio Code will now be able to recognize your (portable) development environment
- If you are still unsure, check it by running the development environment executable (e.g.
gcc --version
,python --version
) inside Visual Studio Code terminal
- Open
VSCodePortable.exe
at least once - Navigate to
D:\Apps\VSCodePortable
(or wherever your install directory is) - Open
VSCodePortable.ini
by using any text editor - Look out for the
[Environment]
section and changePATH
value - To append original system
PATH
, use something likePATH=%PATH%;<path_to_your_de>
. You can also usePATH=__clean__
to emulatePATH
on clean Windows install - (Optional) if the development environment checks for specific environment variable (e.g.
XXX_HOME
,XXXPATH
), navigate toD:\Apps\VSCodePortable\App\AppInfo\Launcher
and openVSCodePortable.ini
file. Add new[Environment]
section (if it doesn't exist) and write the needed environment variable (e.g.XXX_HOME=D:\Apps\CommonFiles\XXX
) under that section - To check if your environment variable is recognized, type
echo %PATH%
(Command Prompt) orecho $PATH
(Bash) or$env:PATH
(PowerShell) inside Visual Studio Code terminal. ReplacePATH
with other variable name depending on your use case
Note: There are at least 3 different VSCodePortable.ini
files! Usually you only need to look the one located in launcher root directory. However, check the instruction again and make sure you modify the correct one!
Assuming that you installed VSCodePortable on D:\Apps\VSCodePortable
(where VSCodePortable.exe
exist), here is some useful environment variable paths you can use:
-
Mainly read by
VSCodePortable.exe
(the launcher):PAL:DataDir
:D:\Apps\VSCodePortable\Data
PAL:AppDir
:D:\Apps\VSCodePortable\App
PAL:LauncherDir
:D:\Apps\VSCodePortable
PAL:LauncherPath
:D:\Apps\VSCodePortable\VSCodePortable.exe
PAL:LauncherFile
:VSCodePortable.exe
PAL:PortableAppsDir
:D:\Apps
PAL:CommonFilesDir
:D:\Apps\CommonFiles
- More from here
-
Frequently read by
Code.exe
and other processes:UserProfile
:C:\User\<your_username>
AppData
:C:\User\<your_username>\AppData\Roaming
LocalAppData
:C:\User\<your_username>\AppData\Local
ProgramData
/AllUsersProfile
:C:\ProgramData
SystemRoot
:C:\Windows
- More from here
Note: Some environment variables listed here are personally made by myself, so they will not appear on the referenced sites.
Some people (including me) are lazy to download new version of development environment everytime a new update was released. Luckily there is MSYS2 that will do all these updates for you by just inputting a single command (pacman -Syu
), and it is portable too! Assuming that you have 64 bit OS, you can download it (.tar
format) from SourceForge here.
- Extract the downloaded MSYS2 to a short path, for example:
C:\MSYS64
- Run
msys2_shell.bat
inside the folder (C:\MSYS64
is the root folder, so it should beC:\MSYS64\msys2_shell.bat
) - Restart MSYS:
- Close MSYS2 by clicking Windows close button (don't type
exit
!) - Run
msys2_shell.bat
again
- Close MSYS2 by clicking Windows close button (don't type
- Inside MSYS2 shell, type
pacman -Syu
and enter - Repeat step 3-4 until all packages are up to date (MSYS2 will say
there is nothing to do
) - Install the packages you want. For example:
- MinGW (64 bit):
pacman -S mingw-w64-x86_64-gcc mingw-w64-x86_64-gdb
- Python (64 bit):
pacman -S mingw-w64-x86_64-python3 mingw-w64-x86_64-python3-pip
- MinGW (64 bit):
- Change both
MINGW
andPYTHON
values insideVSCodePortable.ini
toC:\MSYS64\mingw64
- Start
VSCodePortable.exe
, both of them will now be detected if the paths are correct
Note: MSYS2 packages may have different folder structures compared to native packages, I only test a few packages!
In case you want to do it the hard way (aka manual update), here are some alternative sources that I personally use (I'm also open for suggestions):
Source | Description |
---|---|
WinLibs | Provides up-to-date GCC for Windows, faster than Mingw-w64 (which is incredibly slow at releasing updates) |
Nuwen.net | May not always provides the latest version of GCC, but you can select only the components you need (smaller overall size) |
Adoptium | Provides open-source version of (Java) JDK and JRE. Formerly known as AdoptOpenJDK |
Red Hat OpenJDK | More or less the same as above, but provided by Red Hat |
WinPython | Provides portable installer for Python. This is great since the official Python installer usually can't be extracted properly using workarounds (see below). |
MinGit | Absolute minimal Git directly from the official repo (see wiki), even smaller than the portable installer |
... | For other development environments that are not listed here (e.g. Node.js, Go, Rust), you can usually extract the files from installer using 7-Zip, Universal Extractor 2, or Sandboxie-Plus. Note: Try searching for .zip or .tar release first before relying on those programs! |
- VSCodePortable under the GPL v2.0 license
- PortableApps.com Launcher under the GPL v2.0 license
- Visual Studio Code under Microsoft custom license