Click here to Skip to main content
13,055,047 members (57,158 online)
Click here to Skip to main content
Add your own
alternative version


1 bookmarked
Posted 27 Feb 2012

SharePoint Debugging: Attach all w3wp.exe processes to debugger with single click

, 26 Feb 2012
Rate this:
Please Sign up or sign in to vote.
How to attach all w3wp.exe processes to debugger with single click.

SharePoint developers know that many times they need to debug their custom SharePoint components like web parts and field types. For this purpose developer needs to attach w3wp.exe process with VS debugger again and again. We can create our own visual studio add-in which will help us to attached debugger to all w3wp processes with just one click.

Steps to create add-in:

  1. Open VS2010.

  2. Select File >> New >> Project.

  3. Select ‘Visual Studio Add-In’, you would find this under ‘Other Project Types’ >> Extensibility.

  4. This will bring wizard. Select appropriate options in wizard. Once wizard finishes use below mentioned code in
    Exec method. This code is responsible to attached w3wp.exe processes with debugger. You can use this code to attached any other process as well.

foreach (EnvDTE.Process process in _applicationObject.Debugger.LocalProcesses)
    if (process.Name.ToLower().IndexOf("w3wp") > 0)

Compile your project and run it. This will open another instance of VS. This will automatically deploy your add-in to your local machine. You can find your add-in in tools menu. Later you can create shortcut of this item in you toolbar as well.

If you want to deploy this add-in to any other machine then you can manually copy add-in file in ‘My Documents\Visual Studio 2010\Addins\’. Once you copy this file open it in any editor and change path of assembly.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Rahil Jan Muhammad
Software Developer Comcity (
Australia Australia
I have completed my BS in Software Engineering and MS in Data Engineering & AI system.I have a vast experience in software development using .NET, Oracle and SQL Server
Currently I am working with Comcity ( Comcity is an Austrian IT company, providing services since 2000.

You may also be interested in...


Comments and Discussions

SuggestionDebug with Windows Console App instead. Pin
Jonathan Matthew Beck17-Apr-13 7:19
memberJonathan Matthew Beck17-Apr-13 7:19 
My favorite technique: Don't debug SharePoint Web Parts! Build a Windows Console App and do your debugging there instead.

1) Create a windows console app
2) Copy all the relative code from the web part
3) Replace any ASP.NET control output with Console output
4) Debug and step through
5) Copy the fixed code back to the web part.


General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170713.1 | Last Updated 26 Feb 2012
Article Copyright 2012 by Rahil Jan Muhammad
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid