Welcome to MSDN Blogs Sign in | Join | Help

Sara Ford's Weblog

My adventures embracing open source on CodePlex and at Microsoft

News

    • Did you know... All author proceeds go directly to sending Hurricane Katrina survivors to college.

      Microsoft Visual Studio Tips book

      Recent Entries

Did you know… You can debug an executable that isn’t a part of a Visual Studio project without using Tools – Attach to Process? - #296

And yet another, “I would have never thought to do that” feature in Visual Studio.

There’s the standard Tools – Attach to Process dialog that allows you to attach and debug any process currently running on your machine. But if you’re trying to debug an issue that occurs at startup (meaning the application fails or crashes before you can attach to it) or if the application finishes too quickly before you can attach, there’s still a way to debug it.

Go to File – Open Project and give it the name of the executable. Yes, even thought it isn’t a “project” per se, like a .proj or .sln, the dialog will accept an executable.

Opening notepad.exe as a VS project

Now you’ll see the executable opened in Solution Explorer as a project.

notepad in solution explorer as a project

Just hit F5 as usual to start the executable.

Technorati Tags: ,
Posted: Thursday, August 21, 2008 3:00 AM by saraford

Comments

GP said:

I'm not an expert in debugging, but don't you need symbols or .pdb files in order to debug a process?

# August 21, 2008 9:20 AM

Visual Studio Hacks said:

My latest in a series of the weekly, or more often, summary of interesting links I come across related to Visual Studio. The Web Developer Tools Team announced the release of the Dynamic Data Wizard Preview 0806 for VS 2008 SP1 . US ISV Developer Evangelism

# August 21, 2008 10:32 AM

Michael Reynolds said:

I had not a clue you could do this!  I've claimed in the past this wasn't possible, no I'm changing my tune!  Thanks for the tip!

# August 21, 2008 11:09 AM

MarcT said:

While I can usually figure out the menu items and options checkboxes myself, this is exactly the kind of non-intuitive but awesome tip that keeps me coming back for more! Go Sara Go!

# August 21, 2008 11:24 AM

sonalstarr said:

Why can't I tag this great info?

# August 21, 2008 3:23 PM

DotNetKicks.com said:

You've been kicked (a good thing) - Trackback from DotNetKicks.com

# August 21, 2008 6:13 PM

DebuggingFool said:

That's great!  How do you do it with a Windows Service?

# August 21, 2008 11:22 PM

Lars Wilhelmsen said:

The same goes for dump and minidump files.

--larsw

# August 22, 2008 6:24 AM

Gordon said:

In Visual Studio 2008 Professional SP1, I'm not able to open an Executable with "Open Project...", only with "Open File...".

I get the error "The selected file cannot be opened as a solution or project.  Please select a solution file or project file."

# August 27, 2008 11:31 AM

Saurabh Walia said:

If I m not mistaken, shouldn't the last step be to press F10???

# September 12, 2008 9:46 AM

Raj said:

HEy, Yeah seems Saurabh said correct... you can debug with F10, but with F5 it will execute directly.

# September 12, 2008 9:48 AM

xjb said:

# January 16, 2009 3:52 AM
New Comments to this post are disabled
Page view tracker