Sometimes, debugging a plugin becomes a difficult task, although Microsoft has provided profiling and debugging options in plugin registration tool which is a great feature. However, if a plugin code is complex, it becomes easily unhandy as it does not provide ability to change code and see the result while debugging.

The best tool that can really help is to design your plugin code in a way that the classes can be used outside the plugin. Just take the example below:

solution explorer - debugging plugin

Here ‘ABC Solution’ is the main solution which has 2 projects: ABCSolution.CRM and ABCSolution.CRM.Console.

Steps for debugging plugin

  1. The first project ABCSolution.CRM is the main project that may contain:
    1. Plugins
    2. Custom workflow activities
    3. BLL (Business Logic Layer) folder contains the business logic code for each plugin.
  1. Add ABCSolution.CRM as reference in project ABCSolution.CRM.Console (Console Application)
  2. Call “BLL methods” into your console application
  3. The only effort goes into finding a GUID and passing it to (BLL) class from Console App.

Hope you find this short tip helpful.