In this post I will show you how to create a Build Definition to export your CRM Solution. Before you proceed ensure you were able to successfully create and run the “SampleBase” Build Definition I covered in the previous post.

During the solution export, the process template will go through several optional stages in the order below. These are in addition to the steps covered in the “SampleBase” build definition.

  1. Publish Customizations
  2. Update CRM Solution Version to Build Number
  3. Export CRM Solution

At this stage you can either enhance the build definition created in the previous post or you can follow the same steps to create another build definition and keep the “SampleBase” build definition for reference. I would recommend you install the TFS 2013 Power Tools. This will allow you to clone Build Definitions as I will do below.

image

 

image

 

Steps…

  1. Enter a new name for the cloned Build Definition
    image
  2. Since we configured most properties in the “SampleBase” we just need to worry about the Export section now.
    image
  3. Enter the Connection String  to your source CRM organization where you want to export your CRM Solution from. Note if you use Integrated Authentication, make sure the account running the TFS Build Service is a domain account and it is a user in CRM with the correct privileges. The Connection String uses the CRM Sdk format. You also click on the “…” at the end of the text box to launch a helper dialog.
    image

    image

    image

    image

    image
  4. Enable the Solution Export otherwise this section will be completely skipped by the Build.
    image
  5. Select the Export Type. You can either export the Managed, Unmanaged Solution or both.
    image
  6. Set the below to True if you want the Exported Solution zip files to contain the Solution version. Excluding the version can sometimes be helpful if you have other processes that will need to pickup the Solution files later and are not aware of the Solution version.
    image
  7. Select whether you wan to publish customizations before the Solution Export.
    image
  8. Enable any additional Export settings depending on your needs.
    image
  9. Enter the unique name of the Solution you want to Export
    image
  10. Set a an output path if you want the exported solution files to be placed in a specific directory in the build output folder. This can be help if you are also using the CRM Deployment Package and you want the generated solutions to be placed in the package folder. I will leave this blank for now which means solution files will be placed in the root directory.
    image
  11. Set the below to True if you want the process to update the Version of your CRM Solution to Build Number (part after ‘_’) of the TFS Build.
    image
  12. Now you should have all the settings you need.
    image
  13. Go ahead save this build definition and queue a new Build.
    image
  14. If everything goes well your Build should succeed.
    image
  15. Open the drop folder. You should see the exported solutions with the same version as your TFS Build. Also the solution in CRM would have been updated.
    image

    image

    image
  16. Notice there is also an xml file generated as part of the Build. This contains details about the solutions produced. This can be used later as an input for deployment processes.
    image

    image
  17. If you want to see execution logs. Open the Build in browser mode. You want to look in the Diagnostics tab.
    image

    image
  18. The main things to look in here for is the execution logs of the Dynamics CRM PowerShell Build Script.
    image
  19. Now you should have a build definition that you can trigger manually or schedule to build your CRM Solution. If you have more than one CRM solution you can create a build definition for each as most likely you will need to release these separately. If your requirement is more complex you can extend the template and/or PowerShell scripts to make it suite your needs.

Last edited Aug 19, 2014 at 7:19 PM by waelhamze, version 4