CRM 2011/2013 – Step by Step guide to installing the CRM Developer Toolkit

The CRM Developer Toolkit has become the standard way for developers to develop CRM Customizations.

I personally like this because it means the codes is standardized. It’s not totally standardized because people can still have lots of different ways of storing all the various parts of CRM development.

The first step to installing the CRM Developer Toolkit is to download the CRM SDK, which will be either CRM 2011 or CRM 2013, depending on what project you are developing for.

CRM 2011 SDK

http://www.microsoft.com/en-gb/download/details.aspx?id=24004

CRM 2013 SDK

http://www.microsoft.com/en-gb/download/details.aspx?id=40321

The reason you need to download the CRM SDK is because you will need the CRM Dll’s in your code and the the developer toolkit is hiding away in one of the folders (with lots of other great things, so get nosing around)

 

Download SDK

ie developer loading

Then inside the SDK you will find a folder called Tools

SDK\Tools\DeveloperToolkit

 

There will be two installers

CrmDeveloperTools_Installer

CrmDeveloperToolsVS12_Installer

 

If you have visual studio 2012 chose the vs12 otherwise choose the other one.

 

If it’s a new machine you will probably get  a message saying you need to install Microsoft Identity foundation (I have seen this message many times)

windows identity foundation

You can download it here

http://www.microsoft.com/en-us/download/details.aspx?id=17331

 

You probably have a 64 bit, so select that one, I chose the 6.1

 

You have slipped down the snake and need to click the visual studio installer again, it doesn’t take very long so don’t worry.

 

You will hopefully get further this time and then press next and get to the loading screen, which will sit there for a while.

 

ie developer loading 01

 

Hopefully you will see this beautiful popup, which means you have successfully installed the CRM Developer Toolkit

ie developer loading 01

Close  visual studio if you have it open.

 

Open visual studio, initially you won’t notice any difference, but you will if you create a new project or open an existing project which used the CRM Developer toolkit.

 

When you open or create a new CRM project, then the Connect to Dynamics CRM Server popup will appear.

ie developer loading 02

You need to fill in the CRM details, this is used to deploy your plugins, javascript to the server, selected organizations and solution .  Below is one I filled in for CRM 2013 online trial

Fantastic you have installed the CRM Developer Toolkit.  The next step is to set it up for your CRM Project and connect it up.  I have written a blog post about that already, click the link to continue your journey and get developing

https://crmbusiness.wordpress.com/2014/03/24/setting-up-visual-studio-with-the-developer-toolkit-for-microsoft-dynamics-crm/

I also have a bunch of video’s going through the process which you can find at Hosk CRM Dev

 

There is a good playlist for people starting out with development

http://www.youtube.com/playlist?list=PLsOVDEkdRUuwKulL3l6-sca1Q9zCHiSXn

CRM 2011 – Plugin Deploy Error and CRM Developer toolkit frustrations

Sometimes when you are deploying plugins you can get into a frustrating error stopping you deploying a plugin/custom workflow.  The errors you get don’t really give you can clue as to what the error really is.

In this custom workflow I think I managed to hit most of them.

Firstly, I forgot to sign my custom workflow project (school boy error)

The second error I had was because I had not selected isolation mode, I fixed that by adding this to the RegisterFile.crmregister 

IsolationMode=”None”

So now I was ready, here you can see my trimmed RegisterFile.crmregister.  I have temporarily removed all the plugins/custom workflows so I only deploy the new custom workflow (which is quicker).

You can see I have deployed this before because the ID’s are zero’d.

[sourcecode language='xml']

<?xml version=”1.0″ encoding=”utf-8″?>
<Register xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance&#8221; xmlns:xsd=”http://www.w3.org/2001/XMLSchema&#8221; xmlns=”http://schemas.microsoft.com/crm/2011/tools/pluginregistration”&gt;
<Solutions>
<Solution Assembly=”Plugin.CwaHoskCapacity.dll” Id=”00000000-0000-0000-0000-000000000000″ IsolationMode=”None” SourceType=”Database”>
<WorkflowTypes>
<WorkflowType FriendlyName=”CwaHoskCapacity” Name=”CwaHoskCapacity” Description=”gets the aviailable appointment between two dates” WorkflowActivityGroupName=”CwaHoskCapacity” Id=”00000000-0000-0000-0000-000000000000″ TypeName=”Plugin.CwaHoskCapacity.CwaGetCapacity” />
</WorkflowTypes>
</Solution>
</Solutions>
<XamlWorkflows />
</Register>

[/sourcecode]

 

I tried to deploy but got this error

error

 

Which is below if you can read the picture

Error 17 Error registering plugins and/or workflows. Plug-in assembly does not contain the required types or assembly content cannot be updated. C:\Program Files (x86)\MSBuild\Microsoft\CRM\Microsoft.CrmDeveloperTools.12.targets 176 4 CrmPackage

 

So what is this error, basically I had already deployed the custom workflow (I didn’t remember) but I didn’t have the guid.  So to get round this I unregistered the custom workflow and deleted it.

The Developer Toolkit, great until there’s a problem

I had the pleasure of writing plugins before Microsoft created the CRM Developer toolkit, I remembered at the time trying to persuade people in the office to try it because it made writing and deploying plugins a whole bunch easier.

I have found that 98 percent of the time it works great, but sometimes it can get itself in a mess.

The reason it can be a little temperamental is because it creates all the plugin regisration steps in a the RegisterFile.crmregister and it automatically updates this with your actions in CRM.  So if you create a new plugin project, it adds an xml section and then if you add a new plugin or custom workflow, it adds the line into RegisterFile. crmregister.  

 

One of the biggest problems I have with the RegisterFile.crmregister is when the project is in source control and you add a new project but it can’t update the file.  Then you have a new project, but no new line in the Register file. crmregister.  You don’t really want to manually edit this file because you can get yourself in a real mess.  In this scenario the best thing to do is delete the project and then add it again, but after you have made the registerFile. crmregister not read only/ or editable.

 

For the problem I was experiencing it had created the plugin step but not the actual plugin (e.g. Hosk plugin but no the actual update step).  I didn’t know why but I tried deleting the reference for the package and adding a new one but this then brought up errors complaining about a silverlight project, an error I had never seen before.

Plugin Registration and the Developer toolkit – delete do not add

You can delete plugins and plugin steps without too much worry because all the steps to deploy the plugins/custom workflows are in the RegisterFile.crmregister.  So the next time you click Deploy – it will deploy the plugin you have deleted (or not in my case)

Adding a plugin using the plugin registration is a bad idea because it won’t automatically be deployed/updated next time you hit the deploy button in Visual studio developer toolkit.  You then have to update it manually from now on, which is a pain if all the other plugins are done using the developer toolkit.

 

Final Solution

I finally admitted defeat and had to delete the project in the developer toolkit and add a new project and add a customer workflow to it and copy my code into the custom workflow.

I am still none the wiser what the error and after spending a couple of hours fiddling and trying things without success I finally had to revert to an old version of the files in source control.  I then had to go through the boring process of adding it all back again which only took 30 minutes.

I guess this is one of the disadvantages of relying on the CRM Developer toolkit, all the magic automated code generation can be a mystery when it goes wrong because you aren’t sure what files were changed and with what values, which makes it hard to manually replicate.

It still is a great tool and well done to Microsoft for creating it, it goes wrong so rarely it makes it more frustrating when it happens.

My morning of frustration shows sometimes its quicker to start again than to keep tinkering with a broken CRM Developer Toolkit

The picture was from http://www.pammingle.com