Building VB.NET plugins with the developer toolkit

Scenario:

“I’ve seen the Developer Toolkit for Microsoft Dynamics CRM 2011 and Microsoft Dynamics CRM Online, but it only ships with C# templates.  I’m a VB.NET developer.  How can I get the developer productivity from the toolkit while still writing my plugin code using VB.NET?”

The good news is that SDK obviously supports VB.NET.  The .NET Framework has always allowed you can make calls from C# code to VB.NET code through assembly reference.  Therefore, we can devise a strategy to just make the generated C# code from the toolkit the entry point, but put our plugin code in a referenced VB.NET assembly.

“But my plugin assemblies are sandboxed and database deployed which don’t support referencing other assemblies.”

True, but there’s this wonderful little tool called ILMerge (also available through NuGet).  With ILMerge and a little refactoring, we can achieve this scenario and VB.NET developers can use their language of choice with the developer toolkit.  Here’s a video with step by step instructions.  I use ReSharper in the video to make the refactoring easier.  Everyone who knows me knows I swear by ReSharper, but I understand not everyone loves it like I do or has the budget to acquire it.  I do my best to call out what you’d need to do manually, but you might have to pause now and then if you want to follow along step by step.

You can download the Visual Studio solution that is the output of the walkthrough here.  Reuse it or just grab the post build commands to get this setup yourself, etc.  Hope this helps anyone looking to get more productive with plugin development using VB.NET and the developer toolkit.

@devkeydet

Leave a comment