- In this walkthrough we will learn Step - By - Step How to debug a custom Plugin / Workflow in Dynamics CRM 2011. Once you have developed your custom workflow, you deploy the assembly containing the plugin in the CRM web server, and register it with the Plugin Registration Tool of the CRM 2011 SDK.
- The problem is, every time you change the code, and recompile the assembly, you must redeploy it and the process of debugging-compiling-deploying-registering is very time-consumer and this cycle restarts for every bug and every update you may want to do.
- The best and quickest way of debugging-redeploying your plugin is inside the CRM server itself. If you upgrade your code from inside the CRM web server, the process of debug and redeploy it will be far more quicker. You can also perform the testings against a test Organization.
- First, check whether or not Visual Studio 2010-2012 is installed in the CRM web server. If it doesn't, install it.
- Next, copy the workflow solution to the CRM server, or else develop entirely your Plugin from the Visual Studio in the CRM server.
- Provided you have already built your workflow project, you must deploy it in the CRM server. You copy the assembly from the BIN folder of your project, to the special folder where CRM expects the plugins to be ( Microsoft Dynamics Crm\Server\Bin\Assemply ). Then, open the Plugin Registration Tool, and select "Register New Assembly":
- Specify the assembly location:
- Select the "Database" option:
- Now that your plugin has been registered, you can debug it this way: switch to the workflow project opened in the Visual Studio installed on the CRM web server:
- On the "Debug" tab, select "Attach to Process":
- Now select the two "CrmAsynchService.exe" which are running on the CRM server. Those are the services which take care of the plugins, workflows, and every asynchronic processes being run on the CRM 2011:
- Press the "Attach" for each one of the processes:
- Now debug your workflow at your ease. Open your CRM account and call the workflow which calls your custom plugin/workflow. Wait some seconds (it's an asynchronic process so CRM will decide by its own when to run your plugin) and you'll see that the breakpoints you have set on your code will be reached.
- Let's say that you've found a bug or you need to upgrade the code. You compile it and next you must redeploy the assembly and update the registration of the plugin, and debug again. Therefore, open the BIN folder of your workflow project, and copy the .dll:
- Now open the folder where are stored the CRM custom plugins ( Microsoft Dynamics Crm\Server\Bin\Assemply ):
- Paste there the assembly. Next, open the Plugin Registration Tool, select your assembly and press "Update":
- Specify the location of the assembly to update:
- Finally click the button "Update Selected Plugins":
And now you can debug again your plugin and see how the breakpoints are reached by the runtime.
That's all...Enjoy Dynamics CRMכתב: כרמל שוורצמן
A Step-By-Step Walk-Through CRM 2011 designed for Begginer and Professional CRM Developers
Microsoft Dynamics CRM 2011
Tuesday, December 24, 2013
How to debug a CRM 2011 Custom Plugin / Workflow
by Carmel Schvartzman
Subscribe to:
Posts (Atom)