A CRM Deployment Package can be created using visual studio templates that were provided as part of CRM 2013 SP1 SDK. A CRM Deployment Package allows you to package several CRM components to be ready for deployment. This can include multiple CRM Solutions, Data files and custom logic to be executed during deployment.

Before you can create a build definition to build a CRM Deployment Package, you need to create a CRM Deployment package and add it to your Visual Studio Solution along with your other components. Check out this documentation on how to create your CRM Deployment Package if you haven’t done so yet.

For this build definition I will be using a Sample package that I created and added to my Sample Solution in Visual Studio. From the screen shot below you can see that I have added another Core solution that my Sample Solution depends on and also some configuration data. Note I did not add my “Sample” solution in here. This solution changes frequently and I don’t want to keep adding the latest version to the package so I am going to generate it and add it to package during the Build.

image
Below is the XML configuration file for my package. Note I have declared that my package will be importing my “Sample” solution. Since the version of this solution will be changing and I don’t want to update this file frequently, My build will generate this Solution file in the “SamplePkg” folder without the version number.

Code Snippet
  1. <?xml version="1.0" encoding="utf-16"?>
  2. <configdatastorage xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  3.                    installsampledata="false"
  4.                    waitforsampledatatoinstall="true"
  5.                    agentdesktopzipfile=""
  6.                        agentdesktopexename=""
  7.                    crmmigdataimportfile="ConfigurationData.zip">
  8.   <solutions>
  9.     <configsolutionfile solutionpackagefilename="Core_2_0_0_0_managed.zip" />
  10.     <configsolutionfile solutionpackagefilename="Sample_managed.zip" />
  11.   </solutions>
  12. </configdatastorage>


To make sure the required files by the package configuration are available during the build, you need to ensure they are copied to the output folder. This can be done by changing the properties of the file as per below.
image

image

There is nothing special about building a CRM Deployment Package using TFS Build. Just make sure the package is part of the Visual Studio Solution you are building and ensure all the references to the DLLs required by your CRM Deployment Project and other projects are stored in source control otherwise the compilation on the Build server will fail.

Since we need to generate the “Sample” solution during the build, let’s extend or clone either the “SamplePack” or “SampleExport” build definition we created earlier. In this case I will be cloning the “SampleExport” build definition as a starting point.

Steps…

  1. Enter a name for your build definition
    image
  2. Since we configured most properties in the “SampleExport” we just need to make some slight changes to the Export section below.
    image
  3. Set the below to False to that the exported CRM Solution zip will not contain the version number to match with our package configuration (Sample_managed.zip).
    image
  4. Set the output subfolder path to the below. This will place the exported solution in that subfolder in the drop location. This is where the package configuration is expecting to find the file.
    image
  5. That is all you need to do at this stage. Save the build definition and queue the build.
    image
  6. If everything goes well, your build should succeed.
    image
  7. Click on “Open Drop Folder” to see the package. “DeploymentPackage.dll” is the file containing details and custom deployment logic for your package. The “SamplePkg” contains all the required files by the package.
    image
  8. Open the “SamplePkg” folder you should be able to see all the file you added in visual studio in addition the “Sample solution that was exported during the build.
    image
  9. Now you should have a build definition that can build your CRM Deployment Package including your main CRM Solution. In the next post you will see how you can extend this build to deploy this package to another environment during the build.

In the next post you will see how you can automate the deployment of this package to deploy to your stage or test environment as part of the same build definition.

Last edited Aug 28, 2014 at 6:48 PM by waelhamze, version 5