MS Tech & Coffee

Thoughts of a .NET Developer turned into MS Dynamics architect turned into Power Platform Director turned into AI and Business Transformation Global Lead… all views are my own!

During the last couple of weeks, I have come across several scenarios where people have to spend too much time deploying solutions from one environment to another.

Last week I was showed that in the CRM SDK there is a method to do almost all the point & click actions that a user has to commit in order to do a successful deployment, such as Exporting the Solution, disable the workflows, etc…

Then when the weekend arrived, I was still intrigued about the solutions deployment so I grabbed a cup of coffee and decided to create a simple Console Application to “move” a solution from one environment to another.

The process is quite simple:

  1. First we need to connect our Console Application to CRM, in order to do that, there are multiple examples and ways. The one I chose was using the Simplified Connection example in the SDK.
  2. Then we will list all the Solutions in our Source Solution:
    1. A simple Query Expression will do that 😉

      Important to avoid the Default solution and the System Solutions.

      I am only listing the solutions that the User has created or installed.

       

  3. Ok so now that we have our solutions in an entity collection, let’s give the user the option to choose one of them:

     

 

  1. The User will then select which solution he/she would like to install in the target environment.

 

  1. The Solution Export method will export the selected solution and save it in a temporary folder.

  1. Rather than going back to the path and retrieve the solution I decided to return it so I can now send the file directly to the other method

  1. The next step is to ask the User to enter the Target CRM Environment and the credentials:

  1. Once we have the information, the final step is to connect to that environment and prepare the request for the import:

    In this example I didn’t used any of the attributes of the ImportSolutionRequest, for more information please visit: http://msdn.microsoft.com/en-gb/library/microsoft.crm.sdk.messages.importsolutionrequest_members.aspx

  1. And SOLUTION INSTALLED 😉

 

This is just a really easy example to demonstrate how these web services can be used. There can be many upgrades to this application like:

  • Possibility of selecting multiple solutions.
  • Deploying to more than one environment at the same time.
  • A nice UI 😉
  • And more…

Hope you find this useful.

 

Cheers,

 

Mario

3 responses to “Import/ Export Dynamics CRM 2011 Solutions through Web Services”

  1. Rhett Clinton MVP Avatar

    It would be great if you also showed how to publish the solution after importing it. Great stuff.

    Cheers,
    Rhett

  2. vishal Avatar
    vishal

    thanks

  3. Sonia H Avatar

    Hi thhanks for sharing this

Leave a reply to Rhett Clinton MVP Cancel reply

I’m Mario

Welcome to MS Tech & Coffee, a project I started more than 8 years ago as a place where I could drop things that I was encountering in my journey as .NET developer in the UK. That journey has taken me to many places and now looking back I want to use this project to share some of my personal views on technology, AI, the Microsoft ecosystem and of course.. a bit of coffee!

Let’s connect