Starting with v5, XrmToolkit has an API that allows you to deploy custom plugin and workflow assemblies to Dynamics 365 from a command line. The API can be downloaded here.
To use the XrmToolkit.Api command line, you must first register your license on the computer in which it is installed. If you have Visual Studio installed on the computer, then you can just install the XrmToolkit addin and register your license that way. If this is on a build server or another computer where Visual Studio is not installed, you will need to run a command to register your license.
Open a command prompt and navigate to where the api was installed. The default installation folder is: "C:\Program Files (x86)\Simpler Software\XrmToolkit Api\"
Run the following command: XrmToolkit.Api.exe RegisterLicenseKey [your license key here]
To get a list of available commands, use the -?, -h, or --help option. Currently there are 3 commands available:
To get help regarding any command, use the following arguments: XrmToolkit.Api.Exe [CommandName] --help
The following demonstrates this on the 'RegisterLicenseKey' command:
Using the 'MergeProject' command, you can merge (ILMerge) your assemblies taking into account the XrmToolkit settings for that project.
The following options are available for the MergeProject command:
To build a project using the ILMerge settings, use something similar to the following:
XrmToolkit.Api.exe MergeProject -url=http://crm/orgname -vs="D:\CRM Solution\CRM Solution.sln" -proj="CRM Solution.Plugins.csproj" -b=DEBUG -plat=AnyCPU
Using the 'PublishProjectToCrm' command, you can publish your custom plugin or workflow assembly to Dynamics365. This does not perform the merge operation and so you will need to use the 'MergeProject' command before this one if your assembly needs to be merged first.
The following options are available for the 'PublishProjectToCrm' command:
To publish a plugin or workflow assembly to Dynamics 365, use something similar to the following:
PublishProjectToCrm -url=http://crm/orgname -u=username -p=password -vs="D:\CRM Solution\CRM Solution.sln" -proj="CRM Solution.Plugins.csproj" -b=DEBUG -plat=AnyCPU