
In the increasingly agile programming and DevOps world, not only do you need applications and tools to write modular code, but you may find yourself modularizing your programs.
Whether you're a casual developer or a programming enthusiast, you've probably used Microsoftvs codeIDEs have been around for a while. You probably set custom colors, proper text formatting, and all your favorite stuff. Without a doubt, your VS Code is equipped with extensions and settings that allow you to be more productive. Until that terrible day. Your workstation needs replacing! This could be a hardware failure, a new OS image, or just a hardware update. Either way, you don't want to reinstall and reconfigure VS Code. Fortunately for you, there's a way to start from scratch, but one that makes packing and moving much easier in the future. Let's talk about making VS Code portable with a focus on developing with VS Code primarily through PowerShell on a Windows PC.
What does portable mean?
Portability itself is easy to understand, but what exactly does application portability mean? Traditional software installations on Windows PCs include folders created in the Program Files or Program Files (x86) folder that contain all necessary application files, configurations, and settings. This also means that data is written to the registry and the user's local profile. We then see it listed in Programs and Feature Apps in the Control Panel, from where we can delete or reinstall.
Portable applications keep all the files needed by the application in the source folder. If this source folder were to be moved or changed, nothing would be written to the registry, nor would anything important be written to the user profile. This architecture makes it easy to transfer this app to a USB flash drive, external hard drive or cloud storage location like DropBox, OneDrive or Google Drive. All applications and their settings can be downloaded anytime and anywhere to maximize their efficiency. Configuring this parameter is especially useful for IT support staff who have a digital toolbox of applications needed for testing, analysis, and troubleshooting.
Why do you want to make VS Code portable?
If you remember the beginning of this article, all was well in the world until your workstation was lost, stolen, or crashed. It's safe to say that almost every sysadmin has traveled this road at least once. Maybe a new laptop is coming your way, but the thought of reinstalling everything takes away some of the joy because you remember how much effort you've put into getting your workflow right.
Having a portable VS Code setup is great for moving the PowerShell IDE where you need it. In today's increasingly mobile world, where we work can potentially deliver an ever-increasing return on investment (ROI). With so many companies allowing employees to work remotely, some sysadmins are being forced to rethink the way they work. For example, you might have a perfect setup on your laptop, but now it seems like a pain to be working from home with a slow connection while running scripts on your corporate VPN. Now you find that you need the same setup on a machine or VM in your corporate data center to be effective.
The nice thing about making VS Code portable is that Microsoft supports it, so they support itdocumentmonitor and maintain it. This isn't some wacky MacGyver hack that sometimes works and sometimes doesn't when the stars don't align. Almost all add-ons and everything is super easy to move and allows you to pick up and move your Center of PowerShell Expertise wherever you want!
Portable Getting Started
By making VS Code portable, it's actually pretty easy to start from scratch. continuedownloadVS Code's page and grab the ZIP package for your operating system/architecture. Portable mode is only supported in ZIP downloads for Windows, TAR.GZ downloads for Linux, and regular app downloads for macOS. Unzip the contents of the folder and place it where you want it to last long-term. Feel free to change the folder name too if you wish. The key to making this portable is to create a "data" folder in the root of this extracted folder. For this example, I've extracted the ZIP file to a USB drive and created a Data folder.
The Data folder will contain all settings specific to the portable version of VS Code. Although not required, you can also save all VS Code temperature data in portable mode. Just create a "tmp" folder in your new data folder and VS Code will dump all temperature data into it. By default, VS Code will use the system temporary directory.
Once you're done, you're good to go! Go ahead and install the necessary extensions. Since this article focuses on PowerShell in a Windows environment, let's take a look at the basic extensions you might want to install.
officialPowerShell VS Code ExtensionIt gives you all the look and feel of an IDE designed for PowerShell, such as IntelliSense for cmdlets, definition of cmdlets and variables, and syntax highlighting. These and more are designed to help you code more efficiently on the go.
After installing this extension, as well as any other extensions, it will be located inside the Data folder created inside the extracted ZIP folder you created and moved. It's always a good idea to regularly back up this folder so you don't lose your valuable PowerShell toolkit. You can also check out the GitHub integration for VS Code settings. There are some extensions for this.
In this example, I can move this USB drive to another Windows computer and open VS Code with all my settings and extensions. You might want to make some other tweaks in the VS Code settings to make moving more seamless, such as the default location for the built-in terminal to open. By default, this opens a PS prompt in the current user's folder. You can hardcode this location into a more generic folder, as the profile name will vary from station to station.
Depending on your cloud storage structure and provider, you can also have it set up in a sync folder so you can set these settings for multiple computers you use frequently.
migrate to portable
You're probably reading this and thinking, "That's great! I wish I knew that sooner." Never fear! In just a few steps, you can migrate a standard installation to a portable installation.
- Download the postcode VS distro for your platform as before.
- Create the data folder as described earlier.
- Copy user data folder%APPDATA% codeIn a folder called user-data inside the created Data folder.
- Copy extension folder%USERPROFILE%.vscodeextensionsin the created data folder.
These steps, and those for other OS platforms, can be found in VS Code Portabledocument.After the migration, you may want to backup the data folder as noted earlier. This will ensure that you always have a working copy of the Data folder when you need to pick it up and move it again.
update process
Updating the portable version of VS Code is also simple. Download the latest ZIP release and extract it as in the previous steps. Just copy the Data folder from your working VS Code folder and put it in the same location as the new version. When you're prompted to update in VS Code, it closes and grabs the latest ZIP and puts it in your Downloads folder, which is also fine. It will know that you are using the portable version and will fetch the latest portable version to swap.
You may want to keep the previous version folders in the same place. You can add current folder name_Earliers and keep this version for a while in case you run into particular issues with the latest version. The more extensions you have, the more important it is. Some extension developers may not develop and test their extensions as quickly as VS patches.
This is all new and exciting for budding PowerShell architects. As mentioned, this will definitely help you to build a store that uses VS Code for PowerShell development with more flexibility. This may be relatively unadventurous for most developers out there, but as sysadmins move closer to the world of scripting and programming, you have to get them up to speed. It may also be a natural evolution of the DevOps trends that have occurred in recent years.
read next
- ›6 Ways Our Technology Is Better Than Star Trek
- ›What happened to the two picture TVs?
- ›Update iTunes on Windows Now to Fix Security Vulnerabilities
- ›5 ways to find out if your phone is ringing
- ›10 Kodi Features You Should Be Using
- ›How to Test and Replace a CMOS Battery
FAQs
How do I set up VS Code to be portable? ›
- Download the VS Code (or VS Code Insiders) ZIP distribution for your platform.
- Create the data folder as above.
- Copy the user data directory Code to data and rename it to user-data : Windows %APPDATA%\Code. Linux $HOME/. ...
- Copy the extensions directory to data : Windows %USERPROFILE%\.
Download and install the latest portable setup where you want then run vscode-portable.exe . If you have already installed Visual Studio Code™ from the original setup, move the following files : %APPDATA%\Code\* to data\appdata\Code.
Can I install VS Code on external hard drive? ›You can install visual studio to another hard Drive, but about 75% of the files get installed to System folder by design and the other 25% gets installed to custom install path.
Can I use Visual Studio Code offline? ›You can install extensions manually without an internet connection using the Extensions: Install from VSIX... command, but if you use the extension panel or devcontainer. json to install extensions, your local machine and VS Code Server will need outbound HTTPS (port 443) access to: marketplace.visualstudio.com.
What makes code portable? ›Source code portability refers to building a program in a way that the same source code works in different environments. However, all the platforms must support the same programming language. Data portability refers to data that's movable from one database or data center to another.
What does it mean if programming code is portable? ›It means coding a program in a way so that the same code works in different environments; for example different processors, different operating systems, different versions of libraries etc. If your code is portable, you should be able to just re-compile it on any new system and it should run without problems.
What is the difference between install and portable? ›An installable app will save files to different locations such as its own dedicated folder inside the Program Files folder in your C drive, the App Data folder in your user profile, and other locations. A portable file will not modify the Windows registry in any way.
Can you run VS Code from a USB? ›Make Visual Studio Code portable
We'd like to run VSCode directly from a USB stick, so head over to the downloads section and grab the zipped package. Once the download is finished, move the zip file to your chosen flash drive and extract its content, keeping the directory structure.
A portable install means you can copy the folder, where the program is installed, to a storage device (like a USB flash drive or HDD), and then you can run the program on another computer without having to run an installer.
Is it necessary to install VS Code in C drive? ›No, unfortunately most of Visual Studio still gets installed on the main drive.
Can I install Visual Studio on a USB drive? ›
Many (most?) of the files are in the Program Files(x86) directory so you can't effectively copy them to a flash drive and use them. You could copy the installer to a flash drive and use it to install Visual Studio on each computer you want to use.
How do I use an external hard drive instead of internal? ›- Test the External Hard Drive First before dismantling. ...
- Tear apart the External Hard Drive. ...
- Push the drive out sideways. ...
- Remove the USB control board. ...
- Plug the Hard Drive into your PC as if it were a normal internal hard drive.
Even if you don't have the ability to download Visual Studio from the portal and activate it with a product key, you can still use it if it's included in your subscription. All you need to do is download Visual Studio from the Visual Studio website and sign in. This article will detail the steps for doing that.
How to build Visual Studio Code without running? ›You can use the shortcut "CTRL+SHIFT+B" and it will just build without running.
Does VS Code have cloud storage? ›Cloud Code for VS Code provides IDE support for the full development cycle of Kubernetes and Cloud Run applications, from creating a cluster to running your finished application, and for the development of APIs using Apigee.
What makes code more reusable? ›To reuse code, three things are needed: the ability to access the code, the willingness of developers to write reusable code, and the existence of a library or module that is available for use. In most cases, code reuse is possible due to the proliferation of good, open-source libraries.
What are the advantages of portability in programming? ›Software that requires much environment-related configuration and tuning will cost time and effort as new versions move through the lifecycle. Portability saves time and mental overhead for anyone involved in moving new versions of the software across environments.
Why machine code is not portable? ›Machine languages are so closely related to the structure of a particular computer that they are said to be machine dependent. Programs written in machine language are not portable, that is, they may not be run on other computers with different machine languages.
What is the most portable programming language? ›Java as a language: source code portability
As a programming language Java provides the simplest and most familiar form of portability -- source code portability. A given Java program should produce identical results regardless of the underlying CPU, operating system, or Java compiler.
A portable language is a computer programming language capable of developing software for more than one computer system. For example, C++ is a portable language commonly used today.
Which application we will use to make program more portable? ›
'Windows API' is the application we will use to make the program more portable. Explanation: The Windows API or WinAPI is defined as Microsoft's core set of application Programming Interface in Windows OS.
Is a portable version slower? ›running portable software makes them slower. when u run such apps, registries are added into windows registries. next time u run that app, registries are overwritten. this process makes running apps slower that installed apps.
What are the cons of portable apps? ›Cons of portable apps
If you lose your flash drive, you'll lose all data and work you've done. Reduces settings. Some portable apps don't have all the functions of their full-desktop version. It's not that common though since most developers tend to provide fully-functional portable apps for users.
Portable applications offer some definite advantages over their traditional counterparts. They're lightweight, and they allow you to move between computers while taking your apps and settings with you. Here's why they're different and why they're sometimes—but not always—a good choice.
How do I run a real device in VS Code? ›- [Only de first time] Connect your device over USB.
- In VSCode, hit Ctrl+shift+p, look for and select "ADB:📱 Connect to device IP": Type the IP Address and hit enter. Type the Port number. You should see a toast with "Connected to :". ...
- In VSCode, hit F5 or go to Run > Start Debugging. Enjoy!
Visual Studio is an Integrated Development Environment, also known as an IDE. Visual Studio Code is a code editor. A developer can easily edit their code. VS is slower when it comes to performing across different platforms.
How do I use an external device as an emulator in VS Code? ›- Make sure a target device is selected in the lower, right-hand corner of VS Code.
- Press the F5 button on the keyboard, or invoke Debug>Start Debugging.
- Wait for the app to launch.
- If everything works, after the app has been built, you should see your starter app on your device or simulator:
A thumb drive, also called a USB drive or flash drive, is a small solid-state drive that connects to a device through a USB port. Because USB technology has become such a standard protocol, users can transfer files to and from most personal computers easily with these small, portable drives.
How do I use portable apps installer? ›- Start Your Menu - First, be sure you've start the PortableApps Menu. ...
- Select Install - With the menu shown (click the little PortableApps icon in the system tray if you can't see it) click the Options icon and then select Install a New App form the popup menu.
Prerequisites for running a C program in Visual Studio Code
We should have a basic knowledge of C programming. The Visual Studio Code Editor must be installed in the system. Download the C/C++ Extension. It is an extension provided by Microsoft that support visual studio code.
Where is VS Code stored in C drive? ›
- folder: "\"%HOMEPATH%\\AppData\\Local\\Programs\\Microsoft VS Code\\\""
- executable: "\"%HOMEPATH%\\AppData\\Local\\Programs\\Microsoft VS Code\\bin\\code\""
Your C:\ drive is the drive that your Windows operating system is installed on. Meanwhile, a D:\ drive is a secondary drive (or partition) installed on your system. C and D don't stand for anything, and D: is simply the automatic letter assignment for the next drive added to your system after the primary C:\ drive.
Should I install Visual Studio to my SSD? ›Hard drive type matters!
Visual Studio telemetry shows that machines with an SSD storage load solutions 2-3 times faster than a regular hard drive. As such, we strongly recommend considering an upgrade to SSD if you are using a regular hard drive.
4 vCPU and 16 GB of RAM recommended. Hard disk space: Minimum of 850 MB up to 210 GB of available space, depending on features installed; typical installations require 20-50 GB of free space. We recommend installing Windows and Visual Studio on a solid-state drive (SSD) to increase performance.
How to copy Visual Studio to USB? ›Step 1: Navigate to the folder C:\Users\YourUserName\Documents\Visual Studio Projects. Connect your flash drive to your computer. Step 2: Open the flash drive in a new Windows Explorer. Step 3: Copy the project folder and paste it onto your flash drive.
What should you not do with an external hard drive? ›Try not to mess with the connections.
Avoid plugging/unplugging your external hard drive too often. This could damage the connection, which can also lead to data corruption. It becomes an even bigger issue when you aren't as careful as you should be when dealing with this connection.
While portable drives can offer capacities up to 4TB, they aren't designed for large-scale, long-term use. Desktop drives prioritize longevity, security, and reliability over portability, and are therefore more appropriate for professional, large-scale applications.
How do I move Visual Studio code to another drive? ›If you've already installed it and want to change the location, you must uninstall Visual Studio and then reinstall it. In the Shared components, tools, and SDKs section, select the folder where you want to store the files that are shared by side-by-side Visual Studio installations.
How do I access VS Code remotely? ›Open VS Code on your remote machine. In the VS Code Account menu, select the option to Turn on Remote Tunnel Access…, as demonstrated in the image below. You may also open the Command Palette (F1) and run the command Remote Tunnels: Turn on Remote Tunnel Access.... In a client of your choice, you can open the vscode.
How do I redirect Visual Studio output to a file? ›You can use > to redirect the output of the command run by Visual Studio. Add it to the command arguments by selecting your project in the solution explorer and clicking PROJECT->Properties->Configuration Properties->Debugging. Then enter > output. txt into the Command Arguments.
What is the difference between code-server and VS Code server? ›
What's the difference between code-server and OpenVSCode-Server? code-server and OpenVSCode-Server both allow you to access VS Code via a browser. OpenVSCode-Server is a direct fork of VS Code with changes comitted directly while code-server pulls VS Code in via a submodule and makes changes via patch files.
How do I enable remote access to my computer remotely? ›- Make sure you have Windows 10 Pro. ...
- When you're ready, select Start > Settings > System > Remote Desktop, and turn on Enable Remote Desktop.
- Make note of the name of this PC under How to connect to this PC.
Opening a terminal in a container from VS Code is simple. Once you've opened a folder in a container, any terminal window you open in VS Code (Terminal > New Terminal) will automatically run in the container rather than locally.
What is the best emulator for Visual Studio code? ›We recommend you use Google's emulator when you can, as it offers access to the latest Android OS images and Google Play services. If you have enabled Hyper-V, try out our Hyper-V Android emulator compatibility preview to run Google's emulator on Hyper-V directly.
How do I enable virtual ENV VS Code? ›From within VS Code, you can create local environments, using virtual environments or Anaconda, by opening the Command Palette (Ctrl+Shift+P), start typing the Python: Create Environment command to search, and then select the command. The command presents a list of environment types: Venv or Conda.