How to add source files when debugging a Linux program with Visual Studio 2019 and GCC for Remote Linux

Perrett, Duncan 1 Reputation point
2021-04-22T23:12:56.217+00:00

I have a remote Ubuntu VM with my source code, makefile and resultant program on it.
I have a Windows machine with VS2019 and I am trying to remotely debug the program.
The source code is not currently on the Windows machine at all.
I have created an Empty C++ Linux project.
The SSH connection is working and the Connection Manager seems happy.
The program can be started and the Linux Console shows the program running.

I cannot work out how to add the files so that I can then add breakpoints to them.
Previously when I was using WSL2 I was able to "Add Existing Item" and then browse on my U: (for Ubuntu) wsl drive or \wsl$.

I have read about the Property called Copy Sources https://learn.microsoft.com/en-us/cpp/linux/prop-pages/copy-sources-project?view=msvc-160
but I'd rather not edit the vcxproj file to copy files from Windows to Ubuntu if possible.

Any ideas please?

Developer technologies Visual Studio Debugging
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Dylan Zhu-MSFT 6,426 Reputation points
    2021-04-23T04:17:30.137+00:00

    Hi PerrettDuncan,

    You can try to specified your file path in Project Properties Page/Copy Sources/Additional Sources To Copy
    90554-image.png

    Best Regards, Dylan

    If the answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our * *documentation* to enable e-mail notifications if you want to receive the related email notification for this thread.**


  2. Perrett, Duncan 1 Reputation point
    2021-04-29T08:11:54.353+00:00

    In reference to the "Remote Copy Source Method" -
    How does rsync work for Visual Studio in Windows?
    Have Microsoft got their own rsync implementation hidden in VS2019?
    Or do they just rely on WSL?

    FWIW I've decided to do the synchronising myself in scripts rather than rely on Visual Studio to do it for me.
    My scripts use rsync with ssh from WSL.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.