In the previous post about CRM Workflow Explorer, I introduced a new plugin to XrmToolBox. In this post I will explain how to make your own plugin and add it to the Toolbox.
XrmToolBox is an open source project which provides a container for plugins written by developers from the CRM community. The intent is to provide to the community set of tools that are not available within the set of tools provided by Microsoft from the web client or the SDK application found in the Tools folder.
All these plugins have one thing in common, there are not specific to any organization and can be used in any CRM implementation. If you have a need for a tool that deals with some specific aspects of your organization and would break if used in another one, please don't add it to the Toolbox, it won't be used anyway.
The steps to are as follows:
- preparing the environment
- writing the plugin
- publishing the plugin
Preparing the environment
This tutorial uses Visual Studio 2015 Enterprise edition but you can use other editions and even 2013.
One of the advantages of developing a plugin is that you don’t need to collaborate with other developers on a shared project and deal with all the heavy team source control management tools. A plugin is can be developed separately and added as an extension to the main open source project. To make sure that your plugin is working you will need to test it in the plugins host, In this case the XrmToolBox. Download the plugin container source code from here.
The plugins are libraries published with special tags as NuGet packages, so you will need to register an account here if you don’t have one.
Writing the Plugin
Unzip the source code zip file and open the XrmToolBox.sln solution file.
When you open the solution you should see something like this. There will be errors in VS errors list but don’t worry about them, the solution is configured to get the missing dlls from as NuGet packages so build the solution.
For me after building the solution most of the broken references were resolve, but the following 2 remained.
The 2 errors are caused by some post build commands required by 2 plugins, MetadataocumentGenerator and ChartManager. You can resolve this problem but why bother since you are not maintaining the other plugins. So we will just remove all the plugins we don’t need, all of them under the Plugins folder and leave only the SampleTool plugin. You should end up with this in your solution explorer and the solution compiles successfully this time.
Publishing the Plugin
you will need a to create an account on nuget.org to publish your package. XrmToolBox will query the gallery with specific tags (explained below) to find your plugin and add it to the downloadable list.
If you are using Package Explorer, here are the steps:
- create a new empty package
- right click on the middle of the right panel and create 2 folders: net452 and Plugins.
- drag and drop your dll in the Plugins folder, in my case it's MsCrmToolsWorkflowExplorer.dll
A nuget package comes with a meta file which provides information on the package when other developers search for it. Swith to the editor like shown below and enter the information needed. You can switch between the 3 views using the buttons on the top of the panel.
The meta file you need to have is this one<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>MsCrmTools.WorkflowExplorer</id>
<version>1.2016.0.3</version>
<title>CRM Workflow Explorer</title>
<authors>Hicham Wahbi</authors>
<owners>Hicham Wahbi</owners>
<projectUrl>https://github.com/hicham73/CrmWorkflowExplorer</projectUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Display Workflows in a Tree structure and Graphs</description>
<releaseNotes>This is still in Beta version</releaseNotes>
<copyright>Copyright 2016 MsCrmTools</copyright>
<language />
<tags>XrmToolBox Plugin Workflow Explorer</tags>
<serviceable>true</serviceable>
<dependencies>
<dependency id="XrmToolBox" version="1.2016.10.2" />
</dependencies>
</metadata>
</package>
The dependency element requires little explanation. All the plugin in the Toolbox must defined as dependent on the version of the plugin container you used to test. In my case it was version 1.2016.10.2. You will need to use the buttons on the bottom to lookup the XrmToolBox package from nuget and add it as a required component. It's listed on Nuget as XrmToolBoxPackage, but it's ok you can choose it and then you will need to replace XrmToolBoxPackage with XrmToolBox manually from the xml.
By now you should be able to save an publish. While publishing the explorer will ask you for your connectivity information and your NuGet account credentials.
Happy CRMing

