Recently Microsoft has developed Developer Toolkit for Microsoft Dynamics CRM 2011 that is integrated with Visual Studio to accelerate the development of custom code for Microsoft Dynamics CRM 2011 solutions. Microsoft Dynamics CRM developers can now write custom code from within Visual Studio by using tools and can automatically deploy that code to the CRM from within the visual studio itself.
The Developer toolkit for Microsoft Dynamics CRM 2011 can be downloaded from the Link http://www.microsoft.com/download/en/details.aspx?id=24004
Supporting operating systems are windows7,Windows server 2008.
– After downloading the exe run the crmdevelopertools_installer.msi.
– After successful installation open Visual studio 2010. New Dynamic CRM template will be installed as given in the below screen shot.
The benefits of Developer Toolkit are listed below.
– The Toolkit supports the create, update, delete and deployment of CRM Plug-ins, Workflows (both XAML and custom workflow activities), Silverlight applications and other Web resources including Jscript and HTML.
– Easily generate strongly typed proxy classes without having to run CrmSvcUtil.exe.
– Works with Dynamics CRM Online, On-premise and IFD deployments.
Let me discuss the components one by one
1) Dynamic CRM 2011 Package:1.1) In your new solution, the CrmPackage project is a manifest project that contains all components to be deployed to Microsoft Dynamics CRM combined with their deployment settings. By default, the outputs from each other project are added as references to this project in so that they can be deployed to the server.
So CRMPackage project is required if you want to deploy any component on the CRM server.
1.2) Components are added to the package by adding projects as a reference or by adding components under the WebResources folder.
1.3) The RegisterFile.crmregister contains registration information for plug-ins and custom workflows created by the toolkit. This information is used to register these components during deployment.
2) Plug-in Project:
The Plugins project contains a base class named Plug-in that implements the Microsoft.Xrm.Sdk.IPlugin interface. All plug-in classes generated through the Create Plug-in option of the CRM Explorer will derive from this class. This class simplifies some of the common code that is required by many plug-ins, including the following:
• Obtaining execution context from the service provider.
• Obtaining the tracing service from the service provider.
• Instantiating the Organization Service proxy.
Additionally, the validation method verifies several typical plug-in events and provides a pattern for the developer to extend.
Initially, the derived class’ implementation calls the base class’ implementation before continuing with its own, more specific implementation.
After validating that the plug-in should execute, the base class calls up to the Execute method of the derived class, passing through the execution context and Organization Service proxy.
Use the following procedure to create and deploy a plug-in.
1. Select the Project as given in the below screen shot.
2. User will be prompted for the following information. Specify the login information as well as Organization and the solution where you would like to deploy your components.
3. CRM Explorer is displayed in the visual studio where all the components of the organization specified will be displayed as given in the below screen shot.
locate the entity that you want to create the plug-in for. Right-click the entity and then select Create Plug-in as given in the below screen shot.
User will be prompted for the information’s as given in the below screen shot where we have to give information regarding the events and entity name on which we have to register the Plug-in as given in the below screen shot.
• If the current project already has an existing plug-in assembly registered, you can also use the Add Plug-in shortcut menu option on the existing plug-in assembly and then select the entity you want it to apply to.
4. In the Create Plug-in dialog box, click OK to generate the plug-in code. This action also updates the RegisterFile.crmregister in the CRM Package project to store the plug-in registration information as given in the below screen shot.
5. Open the class that is generated and locate this comment // TODO: Implement your custom Plug-in business logic. Add your custom plug-in business logic to that method.
6. In the Properties of the plug-in project, on the Signing tab, select the Sign the assembly check box and set the strong name key file of your choice.
Deploying your solution
7. Right-click the CRM Package project and select Deploy as given in the below screen shot.
This builds the dependent projects and deploys the plug-in to the Microsoft Dynamics CRM server. any changes to the plug-in are reflected to the server during the build and deploy process.
8) The steps that we have added to the Plug-in gets added to the solution as given in the below screen shot. The Plug-in assembly on which you are currently working displayed in the Green colour.
9) When you click on the any component it will be opened from within the crm Explorer without having need it to open explicitly from browser as given in the below screen shot.
Double click on the entity and it will be opened in your solution itself in separate Tab as given in the below screen shot.
To Add a Step to a Plugin
1. Right-click a plug-in that is part of a plug-in assembly that is included in the current solution and select Add Step.
2. In the Create Plug-in dialog box, configure your step as given in the below screen shot.
Now CRM development made a lot easier.