The new Visual Studio 2015 extension for Linux Debug

Recently, Microsoft Visual Studio team has released a amazing VC++ extension to support remote debugging Linux application by Visual Studio 2015. Using this extension you will have unified debugging experience on Windows, Linux even Android. By this feature, we can debugging a Linux application looks like debugging native app on Windows. The extension can offer developers Quick/Add Watch, Run to cursor,  Go into and so on.

Please follow this steps to setup debugging environment:

1. Please install VSLinuxDebugger.visx extension. It can be download from:

https://visualstudiogallery.msdn.microsoft.com/35dbae07-8c1a-4f9d-94b7-bac16cad9c01

2. You need create a Linux physical or virtual machine. I will create a Ubuntu Linux virtual machine on Azure.

3. After Linux virtual machine provisioning, you'd better get PuTTY tool set (PuTTY.zip) from: https://www.chiark.greenend.org.uk/~sgtatham/putty/download.html

It used to connect Linux console via SSH and copy source code file to Linux.

4. On PuTTY folder, please run PUTTYGEN.EXE to generate key for SSH connection.

 Please copy key raw data from TextBox and paste to notepad. And then save public key to file via Save private key button.

5. Please use PuTTY to connect Linux machine by user name and password.

6. Please run sudo apt-get install gcc g++ nano to install gcc and g++ compiler.

7. Run nano ~/.ssh/authorized_keys to edit SSH connection key file. And then copy key raw data from notepad and paste key raw data to nano editor in one line. At last, press Ctrl + X, Y and Enter to save file.

8. Run mkdir /home/dbg to create a folder named dbg.

9. Run logout to disconnect linux

10. Open Visual Sudio 2015,  Select Visual C++ as language, Cross-platform category, Linux Makefile project

11. Open project properties window, Select Debug Tab. And then set below properties:

Host Name: $(LinuxHostName)
User Name: $(LinuxUsername)
Private Key: $(PrivateKey)             The ppk file you saved on step 4.
PuTTY Home: $(PuttyHome)         Please DO NOT use a path with whitespace.
Remote Working Directory: $(WorkingDirectory)      /home/dbg
Remote Executable Name: $(RemoteExecutable)   Whatever you want.

12. After you completed above steps, you can debug your Linux app remotely like a normal VC++ Win32 app on Windows.

 Enjoy!