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:
Here ‘ABC Solution’ is the main solution which has 2 projects: ABCSolution.CRM and ABCSolution.CRM.Console.
Steps for debugging plugin
- The first project ABCSolution.CRM is the main project that may contain:
- Custom workflow activities
- BLL (Business Logic Layer) folder contains the business logic code for each plugin.
- Add ABCSolution.CRM as reference in project ABCSolution.CRM.Console (Console Application)
- Call “BLL methods” into your console application
- The only effort goes into finding a GUID and passing it to (BLL) class from Console App.
Hope you find this short tip helpful.