Click to Rate and Give Feedback
MSDN
MSDN Library
Visual Studio 2008
Visual Studio
Debugger Roadmap
 How to: Launch the Debugger Automat...

  Switch on low bandwidth view
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
Visual Studio Debugger
How to: Launch the Debugger Automatically

Sometimes, you may need to debug the startup code for an application that is launched by another process. Examples include services and custom setup actions. In these scenarios, you can have the debugger launch and automatically attach when your application starts.

To setup an application to launch the debugger automatically

  1. Start the Registry Editor (regedit).

  2. In the Registry Editor, open the HKEY_LOCAL_MACHINE folder.

  3. Navigate to HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\currentversion\image file execution options.

  4. In the Image File Execution Options folder, locate the name of the application you want to debug, such as myapp.exe. If you cannot find the application you want to debug:

    1. Right-click the Image File Execution Options folder, and on the shortcut menu, click New Key.

    2. Right-click the new key, and on the shortcut menu, click Rename.

    3. Edit the key name to the name of your application; myapp.exe, in this example.

  5. Right-click the myapp.exe folder, and on the shortcut menu, click New String Value.

  6. Right-click the new string value, and on the shortcut menu, click Rename.

  7. Change the name to debugger.

  8. Right-click the new string value, and on the shortcut menu, click Modify.

    The Edit String dialog box appears.

  9. In the Value data box, type vsjitdebugger.exe.

  10. Click OK.

  11. From the Registry menu, click Exit.

  12. The directory containing vsjitdebugger.exe must be in your system path. To add it to the system path, follow these steps:

    1. Open the Control Panel in Classic view, and double-click System.

    2. In System Properties, click the Advanced tab.

    3. On the Advanced tab, click Environment Variables.

    4. In the Environment Variables dialog box, under System variables, select Path, then click the Edit button.

    5. In the Edit System Variable dialog box, add the directory to Variable value. Use a semicolon to separate it from other entries in the list.

    6. Click OK to close the Edit System Variable dialog box.

    7. Click OK to close the Environment Variables dialog box.

    8. Click OK to close the System Properties dialog box.

    Now, use any method to start your application. Visual Studio will start and load the application.

Concepts

Other Resources

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Using CreateProcess with lpApplicationName for the module makes IFEO not work      Dave Bakin   |   Edit   |   Show History
If, in your call to CreateProcess, you put the module name as lpApplicationName and do not repeat it at the beginning of lpCommandLine then the Image File Execution Options registry key will not work: The system will launch the debugger with lpCommandLine only and it won't have a module name to launch. E.g., lpApplicationName="notepad.exe" and lpCommandLine="foobar" and a "notepad.exe" key under "Image File Execution Options" with string debugger=vsjitdebugger.exe will attempt to launch "vsjitdebugger.exe foobar", not "vsjitdebugger.exe notepad.exe foobar". (Observed on Windows XP Pro SP3.)
Tags What's this?: Add a tag
Flag as ContentBug
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker