views:

490

answers:

3

Hi, I'm frustrated.

I already have a window open with the web site I'm debugging. I don't need VS to launch another one for me every time I need to debug.

Is there a way to stop this behavior?

Thank you.

+3  A: 

You can use the Attach To Process function, rather than pressing F5.

This can also allow you to navigate through known working sections without the slowdown of VS debugger loaded underneath.

Slace
I've tried that, but it won't stop execution when it finds a breakpoint. I need it to stop at breakpoints, is there a way to enable that? Thanks.
sker
provided that your attached to a process which has loaded the exact same assemblies which are in the /bin/ folder of the application all breakpoints will work (oh, and provided there are .pdb files!)
Slace
I Googled on how to fix that but it seems like a lot of trouble. I couldn't get it to work. I'll use I Have the Hat's solution in the meanwhile. Thank you.
sker
+3  A: 

When you first open a web/app project, do a Ctrl-F5, which is the shortcut for starting the application without debugging. Then when you subsequently hit F5 and launch the debugger, it will use that instance of IE. Then stop and start the debugging in Visual Studio instead of closing IE.

It works on my machines. I'm using the built in dev web server. Don't know if that makes a difference.

Firefox will also stay open so you can debug in either or both at the same time.

I Have the Hat
Hey that works! Thanks a lot. Now I can avoid around 100 extra windows per coding session. Also, when I hit F5 VS resizes my IE window. Do you know how can I avoid that?
sker
Sorry sker, I don't know the answer to that--it doesn't happen for me doing the above though, so there probably is an answer somewhere. Maybe IE is remembering its window size and it's unrelated to the debugging scenario?
I Have the Hat
+7  A: 

Open your startup project's properties (Project->{ProjectName} Properties... from the main menu or right click your project in the Solution Explorer and choose Properties), then navigate to the Web tab and under Start Action choose Don't open a page. Wait for a request from an external application.

You will still be able to use any browser (or Fiddler, whatever) to access the running application, but it won't open the browser window automatically, it'll just start in the background and wait for any requests.

Pawel Krakowiak
That seems like a really good solution, but just like Slace's, it doesn't stop execution at breakpoints, it says no symbols are loaded. Thanks though.
sker
It does. I use it for debugging all the time. You must have wrong configuration. Double check that you have debugging enabled in the web.config and that you're running a Debug build.
Pawel Krakowiak
Well, at least for web service projects, when started breakpoints get hit as soon as the first client calls a web service method.
Andreas H.R. Nilsson
Thanks! This is a good solution.
Jonathan Parker