In this article I will demonstrate how you can use a LINQPad script to very quickly update Dynamics Solution Numbers in a consistent way across all of your solutions.
Updating your solutions with a meaningful description and version number with every significant change is clearly good practice. It allows us to compare which versions have been deployed to which environments, helps us to see when versions were developed and what has been changed with each release.
Additionally, it might be that you want to take advantage of the deployment option (available for example in Wael Hamze's Azure Devops Tasks) to only deploy the the CRM solution if the version number is different from that which exists in the target environment. (This might be, for example, because your check-in only contains new tests, or some other component which does not need a Dynamics solution deployment.
So, updating Solution Version Numbers is can clearly be useful and good practice, but it's a little cumbersome to do this through the Dynamics front end - we have to log into Dynamics, navigate to the Solutions area, find the solution we've updated, open it, update the version number with whatever the appropriate version number is (and add a comment detailing the change we've made, of course)! Wouldn't it be great if we could simplify this process?
Well, with a little help from LINQPad we can make this a whole lot easier and add some standardisation to the way we version our solutions at the same time. A solution is just an entity in Dynamics like any other, so we can easily retrieve and update the details of a solution using the Dynamics SDK. Here's a method we can use to retrieve a Solution given its name:
Now that we have the details of the solution, we can use LINQPad's TextBox and Button controls to create a simple UI that allows the user to input a new description and save it, as you can see below.
Here is the full text of the LINQpad script:
The format of the version number is a simple Year.Month.Date.IncrementalNumber, but you can clearly amend this to suit your own Versioning strategy. I've uploaded a copy of the script to LINQPad's Instant Share here: share.linqpad.net/uvdbxx.linq