In this post I will show you how you can implement Continuous Delivery for your Dynamics CRM solutions. Using the latest version of Team Foundation Server (TFS), Visual Studio Release Management and xRM CI Framework you will be able to implement one-click automated deployments across all your environments including production. This will enable you provide continuous business value to your stakeholders by releasing small changes more frequently, consistently and reliably. This is very much inline with Agile methodologies of software delivery.
Stage 1: Automate your Builds
Before you can automate your deployment and release processes you need to have an automated consistent way of building your Dynamics CRM components. In terms of deployment your components will be artifacts like CRM Solutions, Configuration Data, CRM Deployment Packages and others. Team Foundation Server provides an excellent Build Automation and Continuous Integration Engine that you can use for this.
Using xRM CI Framework you can easily create automated builds for your Dynamics CRM solutions with a few clicks. Follow the documentation on codeplex to create your build. The build will generate your CRM components and place them in the designated drop location. This can now be picked up by your Release Automation tool which in this case will be Visual Studio Release Management.
Stage 2: Automate your Deployments
Having a consistent build process in place, you can now move into automating the deployment of the components produced above. You will use PowerShell scripts to automate the deployment process. The latest Sdk for Dynamics CRM 2013 comes with PowerShell extensions that allow you deploy CRM Deployment Packages.
The xRM CI Framework comes with two generic PowerShell Scripts. The first one allows you to import CRM Solutions and the second one allows you to deploy a CRM Deployment Package. Depending your scenario you can get started by using either of these scripts and tweak them to your needs. Note the xRM CI Framework also contains many custom PowerShell Cmdlets (Commands) that you can use in your scripts. Check out the documentation on codeplex for more information.
Now you should have some scripts that you can run on to deploy your automated Build outputs.
Stage 3: Automate your Testing
You should be really thinking about this from the start and writing automated tests as requirements come in. The reason I put this at this stage is because as far as Continuous Delivery is concerned you can’t execute your automated tests without having first build and deployed your application to your stage or testing environment. Ideally you want to run Unit Tests during each Check-In and Integration and functional tests in your Continuous Integration and Nightly builds. Finally sanity tests can be run after deployment to your UAT & Production environments.
The xRM Test Framework contains lots of utility classes and productivity tools to allow to easily create Unit and Integration Test for your Dynamics CRM deployments. Check out the detailed documentation and webinars on codeplex. These tests can then be executed during your builds and post your release using Visual Studio Release Management.
Stage 4: Automate your Releases
Once you have your automated builds and deployment scripts ready, you can start thinking about release automation. Release automation allows you to do one click deployments across all your environments. Visual Studio also includes cool features such as security, audit, configuration and environment management and most importantly an easy visual tool to allow you to model your release process using workflows.
In the following post I will show you on how to use Release Management with Dynamics CRM.
Hope you found this post useful.
The xRM Continuous Integration (CI) Framework is a set of tools that makes it easy and quick to automate the builds and deployment of your CRM components.
Implementing continuous integration is always a nice to have feature on Dynamics CRM projects which in most cases gets left for various reasons even though having this setup will save lots of time long term, reduce therisk and improve productivity. Using xRM CI Framework you can quickly implement a build->deploy->test workflow with a few clicks. This is achieved by providing easy to use templates and sample scripts. These can also be easily extend to meet any complex or specific scenarios you might have.
Dynamics CRM 2013 SP1 has been recently released and come with lots of new exiting features and capabilities. This includes an updated SDK. To compliment this release I have updated the xRM CI Framework to take advantage of these new capabilities. Hopefully this will allow you to put in these best practices and automation in place as you start your new Dynamics CRM 2013 projects.
Below is a list of updates from the CRM 2013 version:
- Support for Dynamics CRM 2013 SP1 Online/OnPremise
- Uses the latest Dynamics CRM 2013 SP1 SDK
- Ability to Build and Deploy CRM Deployment Packages
- Integration with Visual Studio Release Management
- More Sample Scripts
- More PowerShell Cmdlets
- New custom Dynamics CRM Build Template for TFS 2013 (see process below)
I have uploaded the source code to codeplex with lots of steps by step instructions to get your started quickly. This will also allow you to extend the framework to meet your needs.
Please post any feedback, comments, issues, discussion on the codeplex site.
Feel free to get in touch if you would like to contribute with ideas, enhancements and new features.
I have also created a download to the new Framework from the Visual Studio Gallery here.
Join me for the next meeting of the CRMUG UK Regional Chapter Meeting on Thursday, July 17th at Microsoft Cardinal Place Victoria, London. The July meeting will focus on using Microsoft Dynamics CRM for managing Customer, Citizen, and other kinds of “Service”. Don’t miss this opportunity to experience what CRMUG has to offer you and fellow Dynamics CRM users in your area!
I will be presenting a session about “One-Click Dynamics CRM Deployments ” at 11:15 AM.
“Find out how you can automate the build and deployment processes for your CRM solutions. The session will demonstrate how the latest tools from the CRM SDK, TFS 2013, Visual Studio Release Management & xRM CI Framework can work together to implement end to end one-click deployments of your enterprise Dynamics CRM Solutions across all your environments. This will allow you to deliver CRM more frequently in a consistent and reliable way.“
Don’t forget to take a look at the full Agenda in here. There will be multiple tracks with a range of topics to suite all roles.
Looking forward to seeing you all in there.
eXtremeCRM is the hub where Microsoft Dynamics CRM partners come together to forge business relationships, gain knowledge from real-world experiences and dive deep into current and future technologies. For Microsoft Dynamics CRM partner organizations, it is the annual conference to attend to nurture best practices, facilitate business growth, and educate each organization member. The highly anticipated conference will be held in Barcelona, Spain, 9 – 12 February, 2014.
Join me on Tuesday 11 Feb at 16:45 in room H3 for my session on “Continuous Delivery – Deliver CRM More Frequently in a Consistent and Reliable Way“. Summary of the session below. You can find all the details in here.
“In this session I will show you what it takes to achieve Continuous Delivery in an enterprise environment through automating the build, deployment and testing of your CRM solutions. I will include a demo of an end to end journey of taking a requirement from definition all the way into production using the latest Automation Tools and best practices (Team Foundation Server 2013, Release Management for Visual Studio, PowerShell & xRM CI Framework for Dynamics CRM 2013). I will discuss suitable implementation options for your target infrastructure to cover on-premise and cloud implementation.
This session will be particularly useful for delivering Dynamics CRM into organizations where there is demand for quick results, quality, efficiency, controlled processes and audit.”
Looking forward to seeing you all in there. Don’t forget to take a look at the full Agenda in here.
The xRM CI Framework is a set of tools that allows you to quickly and easily implement Continuous Integration for your Dynamics CRM solutions. This includes fully Automated Builds & Deployments.
Dynamics CRM 2013 has been recently released and come with lots of new exiting features and capabilities. These include an updated SDK. To compliment this release I have updated the xRM CI Toolkit to take advantage of these new capabilities. Hopefully this will allow you to put in these best practices and automation in place as you start your new Dynamics CRM 2013 projects.
Below is a list of updates from the CRM 2011 version:
- Support for Dynamics CRM 2013 Online/OnPremise
- Uses the latest Dynamics CRM 2013 SDK
- Compatibility with the new CRM Developer Toolkit for Dynamics CRM 2013
- Asynchronous Solution Imports (Check my other post here)
- Sample PowerShell Scripts
Check my previous post for a list of the CRM 2011 version features that are still supported in this release.
Watch out for more posts regarding the above new features and new releases. This will include compatibility and new features for Visual Studio and Team Foundation Server 2013.
Note that even this release you can use the existing automated build templates with TFS 2013. However at this point in time the CRM Developer Toolkit does not work with Visual Studio 2013.
Finally you can download the new Framework from the Visual Studio Gallery here.
In this post will go through the details of the Dynamics CRM TFS Build template “DynamicsCrm2011Template.11.1.xaml” that makes of all this possible. Before I proceed further, a TFS Build template is a workflow that defines the flow and steps of a TFS Build. This is normally implemented using Windows Workflow Foundation. TFS Build allows you provide custom build templates to suite your needs.
The Dynamics CRM 2011 TFS build template extends the default TFS Build template to provide the extra steps required to Build CRM Solutions and implement Continuous Integration.
Below are the high level steps the Dynamics CRM Build will go through. Note that all these steps can be configured using parameters and can be turned on or off to suite your specific scenarios.
- Compile your Visual Studio Solution (Plug-ins, Custom Workflows, Silverlight, Dependencies, etc…)
- Run Unit Tests
- Invoke CRM Developer Toolkit CrmPackage project deployment (deploy solution components from source control)
- Publish Customizations
- Update CRM Solution version number from TFS Build number (the part after the ‘_’)
- Export your CRM Solution from a CRM Instance
- Unpack an exported CRM Solution using Solution Packager and update your source control
- Update version number of your unpacked solution stored in source control (“\Other\Solution.xml”)
- Pack your customizations from source control and produce a CRM Solution Package
- Invoke a PowerShell script to further extend the Build and/or deploy your solution and dependencies
- Run Integration tests on your selected environment
Using various combinations of the above you can implement different types of builds to suite your needs.
Note that all components required to build your CRM Solution should be either in source control or CRM instance for the Build Template to work correctly.
As I mentioned before all of the above can be configured very easily using the TFS Build user interface inside visual studio. So you can create a new build definition in a matter of minutes.
To visualize the build workflow for Dynamics CRM, below is a Visio diagram showing the main flow.
In the coming posts I will go into the details of the different types of Builds you can create and how you can use this template to implement these.
The xRM CI Framework is a set of tools that allows you to quickly and easily implement Continuous Integration for your Dynamics CRM solutions.
The framework provides an implementation of some of the concepts detailed in the recently published Microsoft Dynamics CRM Application Lifecycle Management (ALM) white paper. The framework is also compatible with the Dynamics CRM Developer toolkit from the SDK.
The framework allows you to improve efficiency and consistency by automating your build and deployments using Team Foundation Server (TFS) 2012 and PowerShell.
Below is the list of features provided in the first release.
- Dynamics CRM TFS Build Template that allows you to easily create your Check-In, Continuous Integration, Nightly and Release Builds
- Dynamics CRM PowerShell Cmdlets to extend your build process and automate your deployments
- Ability to support online & offline Dynamics CRM Builds (Build from CRM instance v.s. from source control)
- Ability to trigger automated deployments from your TFS Builds
- Ability to run Integration Tests from your TFS Builds after deployment
- Automatic versioning of your CRM Solutions inline with your TFS Build number
- Ability to automate the updating of your customisations stored in source control from CRM using the solution packager
- Support for Dynamics CRM on-premise & online
- Support for TFS 2012 on-premise & online
- Easy to use and extensible to meet your specific scenarios
Apart from the benefits above you will also get all the benefits of using Team Foundation Server Build to improve your ALM.
There will be a series of blog articles to show you how you can use the framework to implement your specific scenarios in your projects.
In the meantime you can download a copy of the framework from the visual studio gallery.
Don’t forget to check out the setup post on how to get started.
In this post I will provide you with the details on how to setup the xRM CI Framework.
The process is simple and easy. After this stage you will be ready to create your automated builds and deployments.
Framework Download & Installation:
- The first step is to download the setup files from the visual studio gallery.
- Run the setup which will copy all the required files to the installation directory “C:\Program Files (x86)\Xrm CI Framework”.
Automated Build Template Setup:
- The first step is to copy the contents from the installation directory “C:\Program Files (x86)\Xrm CI Framework\CRM 2011\VS 2012\TFS Build Templates” and store them under source control in TFS.
- Once the files are under source control, you will need configure your Build Controller to use the custom assemblies required by the template.
- Follow this link to perform the two steps above. This is based on TFS online but you can use the same process for TFS on premise.
- The final step is to register the Dynamics CRM 2011 Build templates with TFS. Follow this link to register the template by selecting the template from the location in source control from the previous step.
- Now you should be ready to create your first Build Definition using the Dynamics CRM 2011 template.
Dynamics CRM PowerShell Cmdlets Setup
- Start the PowerShell Console and run the command below.
- Import-Module “C:\Program Files (x86)\Xrm CI Framework\CRM 2011\PowerShell Cmdlets\Xrm.Framework.CI.PowerShell.dll”. This will give you access to all the xRM CI Framework PowerShell Cmdlets.
If you are running this on Windows 7 or 8. You will most probably have PowerShell using .NET 2.0 and encounter some errors. To force PowerShell to use .NET follow this blog.
- Create your PowerShell Script using the Cmdlets
This article demonstrated how to setup the xRM CI Framework. In the next blogs i will show you how to configure different types of builds and deployment to suite your specific scenario.
As most of you probably know, Microsoft released an online version of TFS that is host in the cloud. You can find more information about this http://tfs.visualstudio.com/.
This allows you to store and manage all the artefacts related to your application life cycle management in the cloud. This includes source control, work item management and testing.
One of the cool features that TFS provides is Automated Builds. This can among other things compile your code in a consistent way and also run automated tests and produce packages such as your CRM solutions.
TFS online comes with a hosted pre-configured build controller that you can use to build your software. This comes pre-configured with a list of software packages. These don’t include the CRM Developer Toolkit. As such trying to compile any Visual Studio projects created using the CRM Developer Toolkit will not work by default.
In this post I will show you how to configure your CrmPackage project to make it compatible with the hosted build controller.
A typical project created using the CRM Developer Toolkit will look something like the below. This contains Plug-in,Workflow and XAML Workflow projects. It also contains the CrmPackage Project that is used to deploy all the previous components.
Once you created the projects, you will notice that all references to the CRM Sdk and Developer Toolkit Libraries are pointing to the local installation folder of the Developer Toolkit which will not be available on the Hosted Build Server.
To get everything to build online, you will need to store all CRM Sdk libraries in source control and change all the references in your projects (Plugins, Workflows, XAML Workflows) to point to the relative path in your workspace.
The next step is to fix the CrmPackage Project. Right click on the project and select Unload.
Then Right click and edit.
Locate the import statement below. This imports the developer toolkit targets from the installation directory.
Before you change that, you will need to copy the files from the installation directory below and store them in source control along with the CRM Sdk binaries.
Now change the import statement to the relative path in your source control workspace as below.
Now you can save and reload the package project.
At this stage you should be able to rebuild the package project successfully and all the dependencies should be in your workspace together with your source code. Check-in all your changes into source control.
The next step is to create a Build Definition. For example you can create a build definition to compile your code and run your uni tests every time somebody check-in any code. This will ensure that the latest version of your code is always working.
More information on creating build definitions can be found http://msdn.microsoft.com/en-us/library/ms181716.aspx
In my next posts I will show you how to configure and modify your Build definitions to make them more useful. This will include things such as producing CRM Solutions.