Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Develop against folder in WSL in Visual Studio 2019

I've tried to find any information on this, but failed.

Is it possible to use Visual Studio 2019 to develop against a folder on WSL?

I know that it's possible with VS Code and the remote WSL extension, but I really prefer working in Visual Studio.

I also prefer having the code in a folder in WSL since I do a lot of work in the terminal and I've experienced a lot of file locks and other problems when having the code in a folder on the Windows host.

like image 276
Joel Avatar asked Sep 11 '20 07:09

Joel


People also ask

How do I add VS Code to WSL PATH?

Visit the VS Code install page and select the 32 or 64 bit installer. Install Visual Studio Code on Windows (not in your WSL file system). When prompted to Select Additional Tasks during installation, be sure to check the Add to PATH option so you can easily open a folder in WSL using the code command.

How do I open a folder in WSL?

From within WSL Whenever you are in a directory in WSL that you would like to access from File Explorer, simply type: $ explorer.exe . $ explorer.exe .

How do I enable VS Code in WSL?

From VS Code Start VS Code. Press F1, select Remote-WSL: New Window for the default distro or Remote-WSL: New Window using Distro for a specific distro. Use the File menu to open your folder.


Video Answer


1 Answers

In Visual Studio 2019 there is no such equivalent to the remote WSL extension, therefore, it is (still) not possible to open a folder from WSL or WSL2.

However, it is possible to work on a Windows local folder and compile, debug and execute in WSL2. You can follow this tutorial to set it up (also possible with WSL2 without SSH, just tried it and works perfectly). Moreover in the WSL terminal you can navigate to Windows directories mounted in /mnt/[your_disk_name] and execute linux terminal commands.

EDIT: In VS 2022 is now possible. See this

like image 153
Marçal Huete Avatar answered Oct 05 '22 20:10

Marçal Huete