Friday, June 1, 2012

Solution Packager - Enable Source Control for Solutions in CRM 2011

The concept of solutions was introduced in CRM 2011, for the express purpose of having an easy way to combine all the customizations in a packaged format. While this has greatly improved life for people who customize CRM on a daily basis, there are still issues around enabling robust source control for a unmanaged or managed solution.

The solution is available to us in a .zip format, and source control will not be able to track changes in the files within the .zip. This might not be a problem with only one Consultant on a project, but when we have a team of folks working together, tracking changes is not for the faint of heart.

The solution packager is an excellent tool to solve the source control issues. In simple terms, the tool fragments the .zip file into multiple files, with the individual components in specific folders/files, thus enabling granular tracking of changes to components. The solution packager can also be used to convert the fragmented files back into a .zip file, thus reversing the process.

Download Details:

The solution packager is part of the CRM 2011 UR9 beta build. It is a zip file that contains the .exe and a readme. Here are the details on how to get your hands on UR9 beta build.

Using the Solution Packager:

The .exe is a command line tool. It works with both managed and unmanaged solutions, and the parameters it takes depends on whether you are fragmenting the .zip file into folders/files or creating a .zip file.

From the command line, here is how you would extract the files/ folders from the .zip file:
SolutionPackager /action: Extract /zipfile: <location of unmanaged .zip file> /folder: <folder where the .zip is extracted to>

Below is a quick overview of the required parameters used above:

/action: {Extract|Pack}
The action to perform, this can be either: Extract a solution .zip file to a folder, or Pack a folder into a .zip file.
/zipfile: <file path>
The path and name of a CRM Solution .zip file. When extracting this file must exist and will be read from. When packing this will be replaced.
/folder: <folder path>
The path to a folder. When extracting this folder will be created and populated with component files. When packing this folder must already exist and contain previously extracted component files.

Folders are created for Entities, Option Sets, SDKMessage Processing Steps and Webresources.

The folder "Other" contains missecaleneous stuff like Relationships, Site Map, Ribbon Customization etc.

The highlighted sections are the top level folders created from the decomposition of the .zip file:

The ReadMe has more details of the optional command line parameters to use. The ReadMe appendix provides the folder structure that would result from fragmenting the .zip file.

Why use the Solution Packager?

Let us walk through a scenario where solution packager, in tandem with source control, aids in team development of a project. The ReadMe has similar examples laid out, and helps visualize the ways robust source control can be used with CRM 2011 solutions.

  1. Create a solution with necessary components. Export the solution in an unmanaged format.
  2. Extract the .zip file using the solution packager. The extracted components are in their respective folders/ files. 
  3. Upload the folders/ files to source control.
  4. When making a change, Consultant checks out the solution component folders/ files. Using Solution Packager, a .zip file is created from the fragmented folders/files, which can be imported into the CRM server.
  5. After making the necessary changes, the Consultant decomposes the .zip file into multiple folders/ files using the solution packager.
  6. Before checking in the latest files, Consultant synchronizes the Source Control files. If there is an updated version of the file, the Consultant needs to reconcile the conflict by communicating with the team member regarding the change. If there is no conflict, upload the latest files to Source Control.

Tip: For folks who do not care about source control and tracking of changes, the packager could be useful just to back up the webresources (like your js files or images) you have on the CRM server. There are awesome tools (like Mitch Milam's Utility) that let you extract the webresources, and the solution packager is another good option to have in your toolkit.

Final Thoughts:

This is a fantastic addition to the CRM 2011 tool set, and one that I will be using extensively. If you have a team of consultants working on the project and want to streamline the build process, or if you want to track changes over multiple versions of the packaged solution, check it out. It could be worth your while!


  1. Thats great staff.. thanks for sharing this info regarding to CRM solutions..

    CRM in india