I've previously experimented on creating a simplified way of maintaining CRM solutions in source control. While I was quite happy with the end result, the process of setting up the projects, scripts and post-build steps was a little bit tedious.
First, install Yeoman and generator-nullfactory-xrm using npm.
npm install -g yo
npm install -g generator-nullfactory-xrm
Then generate your new project:
Template questions and their purpose:
Visual Studio solution file name? The visual studio solution filename.
Visual Studio project prefix? The prefix for the projects generated. This can be an organization name or preferred convention.
Source CRM server url? This is the source CRM server url. Example:[https://sndbx.crm6.dynamics.com](https://sndbx.crm6.dynamics.com)
Source CRM Username? The username used to connect to the source CRM server.
Source CRM Password? The password for the above account.
Source CRM Solution Name? The name of the CRM solution to be extracted.
Add *.WebResource project? Specifies if a new project should be created to manage the web resouces.
Add *.Plugin project? Specifies if a new plugin project should be created.
Post Installation Setup
Start off by updating the packages for the Nullfactory.Xrm.Tooling project. Open up the Package Manager Console in Visual Studio and execute the following command:
Next, install the Microsoft.Xrm.Data.PowerShell powershell module. On a Windows 10 or later, do this by executing the included powershell script Nullfactory.Xrm.Tooling\_Install\Install-Microsoft.Xrm.Data.PowerShell.ps1 or manually running the following command:
Anytime the CRM solution needs to be synchronized back to the project, execute the script located at Nullfactory.Xrm.Tooling\Scripts\Sync-CrmSolution.Param.ps1.
Edit the mapping file to map to the appropriate resource project. They are located in the Nullfactory.Xrm.Tooling\Mapping folder.
More information on the structure of the mapping file can be found here
Building the CRM Solution
The repackaging the extracted solution is integrated as a post-build step of the solution class library. Simply build it to output both a managed as well as unmanaged CRM solution package.
I think I did pretty good for my first generator and hope to continue to evolve it as I learn more about the templating engine.
Here are some ideas that I have floating around:
* The ability to add multiple CRM solutions in one go.
* The ability to rename the Plugin and WebResources Project
* Add new projects after the initial project structure has been generated.
* Refactor the script to better re-use components.
The generator is hosted in GitHub. Please feel free to fork and hack away at it. I would also appreciate any feedback you might have.