I've used the Dynamics Developer Toolkit since it was first released by MCS for CRM4! I love the functionality it brings however the latest version is still in beta, it isn't supported on VS2017 and there isn't a date when it's likely to be either (yes, you can hack it to make it work but that's not the point J).
Rather than using an add-in Visual Studio project type, I've been attracted by the VS Code style simple project approach and so I decided to create a 'no-frills' alternative that uses a simple json config file (and that can be used in VS2017).
- Deploy Plugins & Workflow Activities - Uses reflection to read plugin registration information directly from the assembly. This has the advantage that the plugin configuration is in the same file as the code. You can use the 'instrument' task to pull down the plugin configuration from Dynamics and add the metadata to your classes if you already have an existing project.
- Deploy Web Resources – deploy webresources from file locations defined in the spkl.json configuration. You can use the 'get-webresources' task to create the spkl.json if you already have webresources deployed.
- Generate Early Bound Types – Uses the spkl.json to define the entities to generate each time the task is run to make the process repeatable.
- Profile management – An optional profile can be supplied to select a different set of configuration from spkl.json. E.g. debug and release build profiles.
Let's assume you have a project in the following structure:
| | |-HtmlPage.htm
| | |-Somefile.js
On both the Plugin and Workflows project, Run the following from the Nuget Console:
This will add the spkl to the packages folder and the metadata CrmPluginConfigurationAttribute.cs that is used to mark up your classes so that spkl can deploy them. Some simple batch files are also included that you can use to get started.
If you already have plugins deployed, you can run the following command line in the context of the Plugins folder:
This will prompt you for a Dynamics Connection, and then search for any deployed plugins and their matching .cs file. If the MyPlugin.cs plugin is already deployed it might end up with the following Attribute metadata:
"name,address1_line1", "Create Step",1,IsolationModeEnum.Sandbox,
UnSecureConfiguration = "Some config")]
A spkl.json file will be created in the project directly similar to:
If you now build your plugins, you can then run the following to deploy
You can run instrument for the workflow project using the same technique which will result in code similar to the following being added to your workflow activity classes:
…and then run the following to deploy:
To get any currently deployed webresources matched to your project files you can run the following from the Webresource project folder:
spkl get-webresources /s:new
Where new is the solution prefix you've used
This will create a spkl.json similar to the following:
You can then deploy using:
For Debug/Release builds you can define multiple profiles that can be triggered using the /p:<profilename> parameter.
"assemblypath": " bin\\Release"
The default profile will be used if no /p: parameter is supplied. You can specify a profile using:
spkl plugins /p:release
Referencing a specific assembly rather than searching the folder
If you have multiple plugins in a single deployment folder and you just want to deploy one, you can explicitly provide the path rather than using the folder search. E.g.
Adding to a solution
If you'd like to automatically add the items deployed to a solution after deployment you can use:
Perhaps you want to have a single spkl.json rather than multiple ones per project. You can simply add them all together:
Multiple project deployments
Since the spkl.json configuration files are searched from the current folder, you can deploy multiple plugins/webresources using a single spkl call from a root folder.
I'll be updating the github documentation page as things move forwards.