Wednesday, August 9, 2017

Dynamics CRM/365 Yeoman Generator

As a result of a recent Twitter exchange I spent a few hours this past weekend and came up with a Yeoman generator for CRM project templates. Now you can create CRM projects from the command line – what fun! But really the potential benefit is being able to work using Visual Studio Code. Maybe not something you’d do for your day to day development but when you’re just trying to do a quick POC of something, firing up VS Code and generating a template here is probably going to be a lot faster then opening up the full version of Visual Studio. As long as you’ve got the C# extension installed you’ll get intellisense and the project templates are configured so you can start running and debugging code right away.

If you aren’t familiar with Yeoman it’s really just a framework for scaffolding out templates for various types of projects and files. It allows you to pull in dependent packages from sources like NuGet or npm as well as to manipulate the items you end up creating.

A few of the features of what I’ve built

  • Choose from a number of different templates:
    • Console 2016+ Project (CrmServiceClient)
    • Console 2011-2015 Project (CrmConnection)
    • Plug-in Project
    • Plug-in Class
    • Custom Workflow Project
    • Custom Workflow Class
  • Pick from the latest version of each major/minor version of the SDK Core Assemblies from NuGet
  • Console projects will get the latest XrmTooling.CoreAssembly or CrmSdk.Extensions version from NuGet corresponding to the SDK Core version that was selected 
  • Console projects will get an appsettings.json file with ready to update connection strings
  • All projects can be used with VS Code or Visual Studio
  • Plug-in and workflow projects will have a new strong name key file generated and assigned to the project
  • Optionally create a Visual Studio solution file

You can check out the code on GitHub:
https://github.com/jlattimer/D365Yeoman

Or on npm:
https://www.npmjs.com/package/generator-d365


If you’re looking to install:
npm install -g yo

npm install -g generator-d365

And then to run:
yo d365

Have fun!