Monday, 11 December 2017

Use of ILSpy in Dynamics 365

If you are part of any Dynamics migration project, you sometime can face this typical issue.

Your customer's previous vendor provided the source code without supplying all the required Proprietary DLLs. This applies to Visual Studio solutions for plugins or custom workflow activities. When you open these solutions, they will not compile and give errors about missing references. 

In these cases there is a workaround "ILSpy". ILSpy is an open -source .NET assembly browser and decompiler. This can be used to view source code and namespaces for a Dynamics CRM plugin/custom workflow DLLs.

Download ILSpy
  • Go to http://ilspy.net and download the binaries. Unzip it in any location on your computer. You can use the ILSpy to de-compile a plugin solution and browse through all namespaces.

Unzip ILSpy Binaries
  • Create a blank solution in source CRM. Include Plugin or workflow assembly. Do not include any sdk message processing steps.
Create Solution with Plugin Assembly
  • Export the solution and save it on your computer. Unzip the solution.
Export Solution
  • Go to folder which has the plugin. Open ILSpy.exe. Drag and drop the plugin to ILSpy.
Open Folder with Plugin Assembly

Open ILSpy.exe

Drag and Drop the Plugin Assembly to ILSpy

As you can see all the namespaces used in a plugin are extracted. This way even if you do not have the DLLs, you can create references in the Visual Studio solution by including all namespaces and the code within. Hopefully this will help compile the code.