I have a c# visual studio 2013 project. I want to use remote debugging. When setting a directory on the remote machine which is identical to the local machine (ie c:\project) it works great, but I have a special directory structure dictated by my TFS and even located on another drive which is not present on the remote machine (e:). I want to know how to define a different working directory on the remote machine from the local one.
-
In my past experiences with remote debugging it hasn't mattered what the directory structure looked like if you successfully connect to the process. However, if the application is working on specific directories and uses absolute paths in the code then the issue may not actually have to do with the debugger.– JNYRangerAug 6, 2015 at 15:27
-
1In this article on MSDN (msdn.microsoft.com/en-us/library/8x6by8d2.aspx) it specifically say to use the same directory structure ("Create a folder on remote1 that is the same path as the Debug folder on local1: C:\Projects\MyWPF\MyWPF\bin\Debug"). It seems odd to me, and I wondered if there is a way around it.– CaptainNemoAug 6, 2015 at 19:47
-
1Just read that article. I've always done it by using the "connect debugger to process" with the remote debugger already set up and running on the remote machine. That article looks like it's for setting up the debugger to deploy/debug on a remote machine which is why it requires the same paths. (I could be wrong about that though since that article isn't the clearest unfortunately)– JNYRangerAug 11, 2015 at 13:10
-
This will help: stackoverflow.com/a/65600577/2377343– T.ToduaJan 6, 2021 at 19:18
2 Answers
How I got around this in Visual Studio 2015 (which is probably still relevant) is by making another build configuration for remote debugging, with the output folder set to a Windows Share on the remote machine. You can secure it with Windows Authentication, and hide the share with the 'hiddenShare$' notation.
I detail it on my blog and reference the corresponding MSDN articles here:
I also offered a similar answer to a similar question, here:
Visual Studio 2013 remote debugging, auto deploy?
- Open Configuration Manager for the solution
- Add a new configuration and name it appropriately. Select the box to automatically do so for all projects.
- Open the project properties of the executable project you wish to remotely debug.
- Ensure that the remote debugging profile is selected.
- Set the build output to the network share on the remote debugging computer.
- Set the remote debugging host address and port.
-
Visual Studio routinely resets the build output path to the 'normal' path (bin\<target>\<config>). Have you found a way around this? I'm not sure if it happens when the remote machine share can't be found (i.e., not on the present network).– mrtumnusDec 7, 2017 at 15:40
Found another workaround:
Create a small virtual disk how to. Create a batch for copying
xcopy [source] [destination] /s /e /y
Just execute batch before debugging.
It should work.