Please excuse my ignorance, I am mainly a Java developer and a bit unfamiliar with Visual Studio and the details of some of the debugging process.
I am creating an application (WPF and Console) in C# that is being developed on my workstation but I need to run/debug the application on another remote machine. Is there a way that I can just hit "Debug" from Visual Studio 2010 and have it emulate a run from the target machine? I need to do this because of local file directory access on the remote machine.
I have looked into remote debugging, but I think I am on the wrong track, as remote debugging just seems to use another machine to run the debugger, not the process itself.
Any information is greatly appreciated!
You will simply attach to process of the running application, for detailed explanation you should take a look at article
Remote Debugging with Visual Studio 2010
you cannot, but you can remote debug and attach to the app running on the remote machine, you will need the remote debugging tools installed on the remote machine
running (F5) on a remote machine, directly from within VS is possible in Dev11, however
Related
I have a remotely published website program that I want to debug locally. I should do this. Is there a good solution? The development tool is vs2015.
Visual Studio have remote debugging feature. You have to attach remote address process (server iis) but firt you have to deploy your code with debug symbols (*.pdb files).
I´m using Anonymous Pipes for my C# applications for a server(WPF project, main application) without admin rights and a client(command line tool just for executing some tasks for the server that need admin rights) with admin rights.
The Anonymous Pipes part is based on http://msdn.microsoft.com/en-us/library/bb546102.aspx
It works fine but my problem is that I can´t seem to debug the client.
The server is the starting project and debugging works fine there. But if I want to debug the client, the pipes have to be provided at startup and handed to the command line
using (PipeStream pipeClient =
new AnonymousPipeClientStream(PipeDirection.In, args[0]))
So how do I debug the client? I have to start the Process over the server process, but how do I get visual studio to hold on breakpoints in the client code then? (Both projects are already in the same Visual studio solution)
As you've already mentioned in the comments, you can't attach the debugger to another process in VS 2010 Express.
This limitation is removed in VS Express 2013 for Windows Desktop, which can be downloaded here. Upgrade and you'll have access to the "Attach to Process..." menu item under DEBUG.
I use remote debugging in visual studio 2012 by using msvsmon.exe on the remote pc, but is there a way to merge this in the setup of the application so I dont have to add the folder to the remote pc and run the app and change the options. Now I know that I can embed it in the installer and run it from my application, but how do I set the options from my application, like the Autehentication mode.
Is there a way to set up Remote Debugging (Msvscom.exe) on a machine that does not have Visual Studio installed?
I would like to attach to the service running on the VM so I can debug an issue in the code. I've done this before but both machines have had VS installed.
The Dev box is running Visual Studio 2010/Windows 7. The VM is running Windows 7 without Visual Studio.
I'm going to resurrect this because anyone who's tried to do this knows it's a complete pain in the ass every time, and that it changes slightly with every possible combination of host/remote system you can have.
Visual Studio Remote Tools Links:
Visual Studio 2010 remote debugger. (Working as of 21/Oct/2016)
Visual Studio 2013 remote tools (working as of 21/Oct/2016)
Visual Studio 2015 remote tools x86 - Direct download link
Visual Studio 2015 remote tools x64 - Direct download link
Visual Studio Tools (Thanks Robo Burned)
Visual Studio 2017 Remote Tools x64 - Direct download link (Thanks Isaac Baker)
Visual Studio 2017 Remote Tools x86 - Direct download link (Thanks Isaac Baker)
Visual Studio 2019 Remote Tools - download link
This is the setup I succeeded with today:
Host (Dev) Machine:
Windows 7 Ultimate SP1 x64. Running Visual Studio 2010, .NET Framework 4.
Remote Machine:
Industrial/Factory Floor PC running Windows Embedded Standard 32-bit. It looks/feels exactly like Windows 7. Running SP1. Visual Studio is not installed. Has the .NET framework 4.
Network:
Both machines are on the same subnet. I access the remote machine via RDP and run my application that way.
Microsoft-Proprietary Follicle-Deterioration Implementation:
Make note of your dev machine's user name and password. For some reason you have to create exactly the same user name and password on the remote machine. Because Microsoft.
How I did it:
I downloaded the Visual Studio 2010 remote debugger from the link provided by #sJhonny. I had to switch off of Visual Studio 2013 in that article and over to 2010. If you care to go over the 2010 article with a fine-tooth comb to find the download, the link is right next to the "No one ever finds this helpful" link at the top. If not, just follow my link above.
Install that on the remote machine and run the configuration wizard. I left the defaults for the wizard:
"Run the 'Visual Studio ....." was checked off
Username is LocalSystem and password is blank
Allow only computers on the local network....
Run the Remote Debugger on the remote system and you'll see
Msvsmon started a new server named 'username#machinename...'
in the interface. So far so good. Run the application on the remote machine. On the dev machine, Ctrl+Alt+P in visual studio will open "Attach to Process" (It's also under the tools menu). I got a popup about my dev machine's firewall not being configured properly and was asked if I wanted to allow the connections etc... Say yes obviously.
Enter the 'username#machinename' combination into the qualifier box... press Refresh and pray a little. Pray a little more a lot harder and you should see a list of the processes running on the remote machine. Select your process and attach to it.
But my breakpoints don't work!? Of course they don't... because using the breakpoints in the same directory as the application on the remote machine would make too much sense. If you were lucky enough, you got warned about a breakpoint cache and got shown a dialog with a path.
The dialog mentions something about it being correct relative to the remote machine. It's lying. It has nothing to do with the remote machine except that it forced you to create a brand new user over there with the same name as your current user because Microsoft. To get your breakpoints to work, follow the path on your dev machine (customizable in Tools>Options>Debugging>Symbols: Cache symbols in this directory) and copy your application's .pdb files over to that directory. You have to copy them over with every new build, unless there's an option to do it automatically; I haven't checked because I have yet to stop celebrating my remote debugging success.
Everything should work now.
certainly there is.
You can install msvsmon without installing visual studio.
I've done this myself on several machines.
the tricky part lays in authorization- the user running VS on your local machine needs special priviliges on the remote machine.
ms has some articles explaining the details- http://msdn.microsoft.com/en-us/library/bt727f1t.aspx,
Update:
Here's the links for 2017 which are not obvious to find either.
Visual Studio Remote Tools Links x64 direct link
Visual Studio Remote Tools Links x86 direct link
Taken from:
how-to-implement-remote-debugging-in-visual-studio-2005
Let's consider an example to understand this situation clearly. Molly
Clark and Adam Barr are both employees at Adventure Works. Adventure
Works has a Microsoft Windows NT domain named adventure-works.com.
Adam is having trouble with some software that Molly wrote. Molly
would like to debug this software on Adam's computer. Molly and Adam
follow these steps:
Adam doesn't have the remote debugger on his computer. To set up the remote debugger, Molly decides to share out the Program
Files\Microsoft Visual Studio 8\Common7\IDE\Remote Debugger directory
on her computer. She creates a file share called Remote.
Adam runs \MollyComputerName\Remote\x86\Msvsmon.exe.
After the remote debugger starts, Adam clicks Permissions on the Tools menu to configure the remote debugger by using the Permissions
dialog box. He gives Molly permission to debug.
Note Adam could also configure the remote debugger by passing the /allow option when the remote debugger starts.
Molly starts Visual Studio 2005.
To open the Attach to Process dialog box, Molly clicks Attach to Process on the Tools menu.
Molly connects to Adam's computer by entering adventure-works.com\Adam#AdamComputerName in the Qualifier box.
Under Available Processes, Molly selects the worker process that her application is using and then clicks Attach.
Molly opens a browser and provides the URL to the remote application. The execution stops where the breakpoint is placed in
the application.
There's also another way which I prefer (if you have fast internet connection).
You don't have to download or install anything on remote desktop connection.
You can share your disk C: while connecting via Remote Desktop Connection.
On the remote desktop go to location (depending on your local location)
\\tsclient\C\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\Remote Debugger\x64
(optional) Create shortcut to folder or msvsmon.exe on desktop
Run it remotely from your local disk via shared disk. (start can take few seconds depending on your connection quality)
Option2: Copy Remote Debugger\x64 or x86 folder to the remote location and use it.
I was able to get it working with asp.net core 2.1, the only difference from the answers above was that the process you attach to is dotnet.exe.
Local Debugging Fine
I would like to attach a Visual Studio debugger to my WCF application (w3wp.exe worker process).
I can do that successfully on my developement server where I have Visual Studio installed locally.
How to Debug on EC2?
Now I need to occasionally do that on my production server which is an Amazon Web Services EC2 instance.
With regards to remote debugging MSDN says: Debugging over the internet is not supported. - So is there no way to attach a debugger remotely to a WCF application running on an EC2 instance?
The only solution I know is that I have to install Visual Studio on the EC2 instance (time and disk space) as well as put the source code there, and then use local debugging? Hoping for an alternative and better solution?
Not a best practise but you could have one EC2 instance or EBS snapshot where Visual Studio is installed. Bring that up to debug effectively locally by RDP'ing into that server and then when you are finished you can swap back to the clean production server.
If installing VS is a problem, you can setup a VPN client and the Remote Tools (which is much smaller than VS install).
The idea is to setup a VPN between your machine and the EC2 instance, install Remote Tools (actually you might not even need to do that, just run msvsmon.exe) and connect using the VPN.
More info:
My blog post
remote debugger over internet