Monday, 21 March 2011

Plugin Deployment in CRM 2011 - Best Practices

    As you all know, the new concept called 'Solution' which bundles the components was introduced in CRM 2011. Solutions could help us to deploy plug-ins in a very good manner. If you open a solution in CRM 2011 you could find out a section called 'Plug-in Assemblies'.


Now consider a scenario that we have a plug-in called myPlugin with steps Create and Update of Contact Entity. So let's register the plugin using the CRM 2011 Plugin Registration tool.



Once its registered, it would be available in our solution. So navigate to Plug-in Assemblies section of the solution and click on 'Add Existing button' . Then you would get the following window. All registered plugins would be listed here.



We could choose the plugin and then click OK.



So our plugin is added to the solution as shown above. So this is how we bundle the plugin in the solution. However its a very good practice to bundle the steps of plugin too. So lets consider the following 2 steps to be bundled in the solution.
Create Contact  & Update Contact steps


So navigate to 'Sdk Message Processing Steps' section of our solution which could be found just below the 'Plug-in Assemblies' section. And click on add existing option.


Choose the message steps as shown and then click OK.

As you could see the plugin message steps are added to the soultion.


Very Important step: Select the steps and click on Activate Button. Please don't forget this step


The key advantage of this practice is when you move the solution to another server for instance from development server to the production server, you don't need to deploy the plugins again. Because the plugins and steps are already wrapped with solution.
Related article: How to use ILMerge
http://crmdm.blogspot.com/2011/02/crm-cannot-find-plugin-assembly-or-one.html

5 comments:

  1. Need to find out that if the some step of a plugin has secure/unsecure configuration then how can we change them for deployment to different envirnoment

    ReplyDelete
  2. Hi Ahsan,
    As per my knowledge, Plugin Registration Tool is the only way to change unsecure configuration once its deployed in another environment. OR A small suggestion for you. if you are sure with the parameter values of another environment well in advance, then for each deployment, change the parameters and save before deployment so that it will be included in the solution as described in the post. The only advantage of this would be you don't need to change parameters in the another environment.
    About Secure configuration, I did a test with Secure configuration parameter. But when my solution was deployed as manged solution in anther environment, it was found that the secure configuration parameter was empty. So I think when we export as managed, Secure Configuration is automatically excluded from Solution. It may be due to security reasons. I need to do more research on this.

    ReplyDelete
  3. Hi All,
    Secure configuration will be empty for unmanaged solution also...

    Regards,
    Prabhu G

    ReplyDelete
  4. Hi , if you are developing the plugins using developer toolkit then there is way to do that .
    You will get "PluginPackage" to deploy all the plugin what all you created. Then in that "PluginPackage" solution you can see "RegisterFile.crmregister" file which can be editable .
    So , if edit that "RegisterFile.crmregister" file ,there you can see the secure and unsecure configuration values for the steps which you registered. That you can modify and save it , when u r exporting the solution this file will get added to the solution . Now you can see the changes in the new solution , you can deploy that in the new environment.

    ReplyDelete
  5. Thanks this article helped me a lot.. i did not click on Activate Button, and as a result none of the plugins were not firing in the test environment.. saved my day!!..

    ReplyDelete