One challenge you face as an xRM development team is management of the customizations. Even with the addition of Solutions in CRM 2011, maintaining customizations across multiple environments poses several challenges, such as:
- Maintaining a common schema – across multiple CRM instances, how do you ensure that all entities have the same schema?
- Stepping on teammates’ work – when one developer deploys their latest work, how do you ensure other’s work is not overwritten?
- Entity and attribute cleanup – as the schema for a project solidifies, how do you ensure old and unused elements are not unnecessarily deployed to production?
One approach in managing shared customizations is to mandate your team to work on a shared CRM instance. The shared instance serves as the master customizations copy from which deployments are cut and checked into source code control. This will ensure that all developers are working against the same copy of customizations, scripts, workflows and other solution components. This approach can quickly become unwieldy or costly. The shared instance my not have enough resources such as RAM or CPU that makes multiple concurrent developers almost impossible. Some tasks may involve work that impacts others, such as updating a shared entity or script library. Development and testing of work in progress often impedes the team if a developer is debugging or changing shared resources. Your team can take a hybrid approach: maintain the master copy of customizations while developers perform day to day work on own local instances. While the hybrid approach offers flexibility for developers while ensuring a master customizations copy, your team still faces the issue of syncing up the developer’s work to the master copy.
A Helpful Utility
One tool available to you when syncing your customizations is the CRM Solution Packager tool. This utility is a command line application included with the CRM SDK and will both extract and repackage a CRM solution export. When the tool extracts a CRM solution, the customizations.xml and all related resources will be extracted into their component parts on disk. This allows you to browse through solution components on your file system rather than digging into the somewhat cryptic contents of the solution zip file. Once the SDK is downloaded, the tool can be found at \SDK\Bin\SolutionPackager.exe. Full SDK documentation on the tool can be found online at Solution Tools for Team Development, https://msdn.microsoft.com/en-us/library/jj602974(v=crm.5).aspx. This article includes full details on command line options and some scenarios for including the tool with source code control. As an example, an export of a baseline CRM 2011 instance will look like this: If you drill into the Account folder for under Entities, you will see the following: The Solution Packager utility extracted the individual entity XML sections into their own files, making it much easier to review.
Command line usage
Using the Solution Packager tool is straight forward, exporting with just a few command line parameters. In the example below, my default solution was exported to c:\temp with the name Default_1_0.zip.
set exec="D:\_Learning\CRM 2011\sdk\bin\solutionpackager.exe" set root_path="C:\temp" set package=Default_1_0 del %package%\*.* /s /q rmdir %package% mkdir %package%%exec% ^ /action:Extract ^ /allowDelete:no ^ /packageType:Unmanaged ^ /folder:%root_path%\%package% ^ /zipfile:%root_path%\%package%.zip
If you add a custom entity to the solution, it also shows in the folder structure. For example, I created a new custom entity called Widget and exported to a new solution file named Default_2_0.zip: Notice that the custom entity contains some additional information, such as the Form Xml and Saved Queries for the custom entity. Because they had not been modified from the default system values, the out of the box entities did not include the additional information when exported. The Solution Packager can take the same extract and repackage the contents into a valid CRM solution zip file, ready for reimport. For example, if we wanted to modify a label on an entity attribute, we could update the entity component Entity.xml file and repackage the solution for import. This seems like a bit overkill for such a simple task: you could simply use the form designer and re-export the solution.