This template outlines a method of organising code resources (web resources, assemblies and data) that are developed for a Microsoft Dynamics Project within Visual Studio, and within Source Control.
To install the template, simply download the extension and install it in Visual Studio.
To create a new project based on this template, within Visual Studio, simply go to the File menu, select New, Project like below.
This should bring up the standard Project type selector, and in the list should be an option for Microsoft Dynamics Template.
Give it a name, and select which location you wish to store it in, and click OK. This will create a solution and the required projects for you as below:
Description of the projects
There are six Projects within the solution (and you can add more if required), and these are explained below.
This is the main Assembly project for creating Plugins and Workflow Activities. It should be ready to build as it uses NuGet references. The only thing you will need to do before uploading your Plugin Assembly into Microsoft Dynamics is to sign it with a key file.
Feel free to delete the sample plugins, or reuse and rename them to something more appropriate. Also make sure you amend the Namespace within the Properties for the Project to what you require.
Always ensure you name namespaces and classes correctly and organise them in the correct folders to avoid complications later as once its uploaded into Dynamics, it can be problematic to change it.
The data project is designed to store any Dynamics CSV files that may be required for you system.
If you place any CSV files within the Data folder, whenever you build the project, these CSV files are combined into a ZIP file.
This gives you an easy way to edit them locally within Visual Studio.
The Dynamics project is designed to hold an unpacked copy of a CRM solution. It can hold multiple solutions within separate folders. This keeps all the web resources neatly organised and allows you to check in all of the components into Source Control.
To get started, simply export your CRM solutions from dynamics as unmanaged, and save them into the _solutions folder, but removing the version numbering.
Once you have done that, simply run the Unpack.bat file located in the Dynamics Project folder.
This will unpack all of the elements from the various CRM solutions into separate folders.
In Visual Studio, within the Project, select the option to Show All Files.
Then right click on the newly created folders, and choose Include In Project. This will add everything from the Solution file into your Visual Studio Project.
From now on, if you wish to edit any of the Web Resources, you can edit them from that location within the Project, and any changes you make can be checked in to Source Control.
Dynamics Web Resources Project
The support project is just a place holder for all of the support files used in building the data zip file, and unpacking the CRM solutions.
- Never mix Plugin code with Web Resource code, always keep them in separate projects.
- Always organise web resources with the correct folder structure to match the name within Dynamics. If you are creating new web resources, make sure you place it in a folder within your Visual Studio project that mirrors what its name is in CRM.