The Microsoft Dynamics CRM User Experience team is always looking to improve our customers’ experience when using the SDK. Past examples of our work in this area include publishing the Plug-in Developer tool and the Plug-in Registration tool for registering plug-ins and custom workflow activities. This blog is about another useful tool for your development toolbox, a C# and VB plug-in template for Microsoft Visual Studio 2008.
Since I have to write plug-ins now and then, I wanted to come up with a standard Visual Studio code template for writing a plug-in. In the code template provided in this blog I have included the following features:
- A plug-in constructor that supports passing secure and non-secure information to the plug-in
- A standard Execute method that retrieves and verifies information from the passed context parameter
- Web service proxy instantiation
- Basic handling of SOAP exceptions
- Custom methods that instantiate the Web service proxies for those plug-ins that execute in a child pipeline
The complete plug-in template can be downloaded here. To install the template into Visual Studio, copy the downloaded zip file into your Visual Studio 2008\Templates\ProjectTemplates\Visual C# (or Visual Basic) folder.
To use the template, simply create a new project in Visual Studio, select a C# or Visual Basic project type in the New Project dialog box, and then select the MSCRM Plug-in template.
After creating the new project, you may need to remove and then add the project references to the Microsoft.Crm.Sdk and Microsoft.Crm.SdkTypeProxy assemblies in Solution Explorer if Visual Studio cannot find the assemblies on your system when you build the project. In the project’s property page on the Signing tab, remember to check Sign the assembly and create a new key file.