PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Sunday, May 15, 2022

[FIXED] How to install Visual Studio Code on WSL2?

 May 15, 2022     installation, ubuntu, visual-studio-code, windows-subsystem-for-linux, wsl-2     No comments   

Issue

I want to use Visual Studio Code already installed on Windows for WSL2 (I use ubuntu app on Microsoft Store). When I cd into the directory to use and type code . then show an error message

To use Visual Studio Code with the Windows Subsystem for Linux, please install Visual Studio Code in Windows and uninstall the Linux version in WSL. You can then use the code command in a WSL terminal just as you would in a normal command prompt.

I have installed Remote - WSL plugin on Visual Studio Code and it works but can't open Visual Studio Code on ubuntu app.


Solution

I solved my problem, the cause is same as in messeage:

To use Visual Studio Code with the Windows Subsystem for Linux, please install Visual Studio Code in Windows and uninstall the Linux version in WSL. You can then use the code command in a WSL terminal just as you would in a normal command prompt.

I installed extra Visual Studio Code on ubuntu app (this is not necessary) so when i type code . the system will understand that I'm using Visual Studio Code already installed on ubuntu app I uninstall Visual Studio Code on ubuntu app by

sudo dpkg --purge code
rm -rf ~/.vscode

Note: make sure that the default of wsl is now ubuntu app, otherwise use the following command:

wsl -s Ubuntu-20.04   

enter image description here

Then I typed code . on ubuntu app it actually opened Visual Studio Code on Windows for me.

enter image description here

Thanks for Watching!



Answered By - quoc9x
Answer Checked By - Katrina (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing