How to: Debug a Feature Receiver


One of the new features in the Microsoft® Visual Studio® 2010 development system is the ability to press F5 to debug Microsoft SharePoint® components, such as feature receivers. However, to debug a feature receiver class, you must configure your SharePoint project to use the No Activation deployment configuration. This means that Visual Studio 2010 will install your features, but you must manually activate them through the user interface. This how-to topic describes how to change your deployment configuration and debug a feature receiver class.

This how-to topic uses the ExecutionModels.Sandboxed solution as an example of a project with feature receiver classes.


To debug a feature receiver in Visual Studio 2010

  1. Open the Visual Studio 2010 project that contains your feature.
  2. In Solution Explorer, right-click the project node, and then click Properties.
  3. On the SharePoint tab, in the Active Deployment Configuration drop-down list, click No Activation.


  4. Open the feature receiver class that you want to debug, and then insert a breakpoint.


  5. Press F5 to deploy and debug your solution. In the Attach Security Warning dialog box, click OK.
  6. Activate your feature through the browser user interface.


  7. Verify that the debugger stops at your breakpoint.