Dynamics CRM automated deployment using dynamics crm developer toolkit from the SDK

Microsoft Dynamcis CRM developer toolkit that comes with the CRM SDK provides a wide variety of useful features. If you have created a Dynamics CRM Solution in Visual Studio using the Developer toolkit add-on that gets installed onto your Visual Studio, you can easily deploy your Dynamics CRM code directly by right clicking on the CRMPackage project of the solution and clicking deploy. This Deploy command will build and deploy all your plugins, custom workflows, web resources, etc.

In a previous post, I wrote about automated deployment of Dynamcis CRM using MSBuild from Visual Studio to your Dynamics CRM Server. In this post though, I will cover how to use the deploy command of the developer toolkit to automate your deployment of Dynamics CRM Visual Studio solutions onto your Dynamics CRM organisation.

The deploy command can be easily accessed from the Visual Studio Command prompt. You can then call the deploy command in the command shell. To make it easier, you can create a batch file that calls Visual Studio command prompt, navigates to where your CRMPackage project is and then finally calls the deploy command. This batch file can then be scheduled to run using a Windows Scheduled Task to automate the deployment of your Solution at pre-scheduled times.

Sample code for the deployment automation batch file to deploy the CRMPackage project is below:

call "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\vcvars32.bat"
cd C:\Users\YourUser\Documents\Visual Studio 2010\Projects\CRM-Solution-Folder
devenv crm-solution.sln /deploy "debug"  /project CrmPackage

Enjoy! Tried and Tested.