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
Then I typed code .
on ubuntu app it actually opened Visual Studio Code
on Windows for me.
Thanks for Watching!
Answered By - quoc9x Answer Checked By - Katrina (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.