7. Export solutions
In this video we’re going to have a look at exporting solutions. Now, first of all, the default solution cannot be exported. You can see a lack of export options on the default solution, but not on the database default solution. So you can export that. Now obviously you can only export unmanaged solutions. Managed solutions are one use import into your environment and they are fairly well locked down. We had a look at a previous video as to what sort of things can be locked down. If you go to manage properties, you can see things like forms, charts and views. Now, these locking downs only take effect when the solution is managed.
So it doesn’t apply to unmanaged solutions. So what I’m going to do is create a new solution, which is going to be my export solution and with my publisher, and I’m going to import into that one at existing, I’m going to just start with something really small. I’m just going to have the weather conditions recorded so that is my solution. And then I can add more and more. Generally when exporting and importing solutions, I would start with something small. You may find that you’ve got dependencies between solutions and it can cause a fair bit of time if you’re not sure where the problem is. So I’m going to export just this one simple cloud flow and I’m going to click on export. There’s also an export button right at the top so I can run for issues.
So this gives me exactly the same thing as a solution checker, useful if you haven’t done that already. And if you’ve made changes that you’d like to export, then there is a publish button. So both of those well worth having a look at. Just see what is there, what it might report the solution checker. So go to next. And now it’s giving me okay, what is the version number? So the version number is four numbers separated by dots. These numbers are major number, minor number, build number, and revision number. So major minor build and revision.
And in the next video we’re going to have a look at a situation where you might update the major minor numbers and another way you might update the bold revision. So it’s just going to be a minor change. It’s going to therefore be major one and revision one, minor, zero, bold zero. Now, am I exporting it as an unmanaged solution? So am I putting it into another development environment or source control? Or am I going to manage it? So am I moving it to a test or a production environment? So I’m going to export this and you can see currently exporting the solution and it will come as a zip file right at the bottom in a few minutes. There it is.
Now, before you export, you might just want to go into any of the components and have a look at the managed properties and see, do you want to allow customizations and if so, what options it gives you and so forth. So now I’ve got this exported, I’m going to import it into my importing environment. So let’s go to solutions in my other environment and I’m going to go to import. So you can see I’m in this particular solution and I’m going to browse for solution file. So here it is. So it’s the name of the solution, whether it’s managed or unmanaged.
And then you’ve got your version number again, major minor build revision. So let’s open that up. Go to next if you’ve got any problems at this stage, if you’ve got any dependencies, for example, this solution requires other components that aren’t in it. You will see that right at the top now we can see some advanced settings. So for instance, do you want to enable steps and flaws included in the solution? So when you import them, are they going to be imported, disabled, so not running? Or are they going to be running? Now while that’s importing, just a reminder, you can’t add instant solutions into a solution when it’s created outside of a solution, so it’s not solution aware and the floor trigger is set to manual. You can’t edit the components within a managed solution. So you can see here is our export solution so I can’t remove, I can’t edit and I haven’t got any customizations that I can use if you try and import a solution and find it’s not successful.
So here’s one that I created earlier, one that I know is not going to be successful. You’ll see, at the top we have a bar saying there are missing dependencies to give you a solution. Install the following solutions before installing this one and you can also download details which will download a log which will say okay, there are some things which are missing and in this particular thing, the thing that’s missing is the expense table, so I would have to re import that. So this is why I generally go for smaller solutions to start with or I create everything within a solution and then I know it’s fully packaged.
If your solution contains connection references like we saw when we were importing a floor, then you may be prompted to select or create the references for the connections. However, once you have done all of this, once you’ve got your tables, once you’ve got everything installed for the very first time in a new environment, you’ll probably find that as long as you keep adding new things inside that solution, you’ll be able to keep updating and updating and updating. And speaking of updating, in the next video we’re going to update our export solution and see what happens when we import it again. And we’re also going to have a look at some other ways you can sort support development of solutions.
8. Support deployment of solutions to testing and production environments
Now, in this video, what I’m going to do is I’m going to export my solution again. I’ve already published all the changes and this is now version 1. 0. 0 . 3. So once it’s exported like that, which just took a few seconds, I’m now going to reimport it into the importing environment. So I’m going to import it, I’m going to find this version once click next and we find that we have got a few more settings. Why? This solution package contains an update for a solution that is already installed. Now, upgrading a solution can modify objects on the target and this may include things that you don’t want updating. So this is why we are being given three new options.
So the first one, which is the recommended, remember that a managed solution, unless you allow customizations is like a black box. So it just comes and you’re not allowed to edit the things. So if you upgrade, you’re upgrading your solution to the latest version. So this would be 1. 0. 3, any components not present in the newest solution will be deleted. So in other words, it upgrades your solution to the latest version. If you’ve done any patches, we’ll talk about patches in a moment. Then it rolls them all off into one step and deletes anything that is not necessary for the latest version. So this is recommended because the end result will be consistent with the export.
So the import will be the same as the export, including the removal of components. Now, if you stage for upgrade, what this upgrades your solution to the latest version but it doesn’t delete anything that’s old, any old components. So you can have the old and the new solutions installed at the same time. So you can then later apply the upgrade and delete the old solutions and unneeded components.
And then there is update that replaces the solution but it doesn’t delete old components, it’s not recommended because what you’ve now got in your destination environment will be different from the source environment. So generally you would use upgrade unless you’ve got a really good reason not to do so. If you have done any customizations which are unmanaged, then you will be able to choose whether to maintain or overwrite these unmanaged customizations. So let’s import that and our version will go up from one 0. 01 to one 0. 03. So that is the best way to support the deployment of solutions from development to testing and production environments. Now, if you just needed to update something, so a minor change, then you could use a patch. So if you patch something then it goes from the unmanaged solution to the manual solution.
So you can include only the changes to tables and related table assets. So you patch a solution by going to solution Explorer and clone a patch. Now, the version number, remember it is major minor build version. So it’s going to have the same major minor numbers but a higher build number and revision number. So that is how you create a patch. You can have multiple patches for a single solution. Now, you can also clone a solution.
So what this does is it rolls up all related patches and creates a new solution. And then in your clone solution you can add, delete or edit components or assets in your clone solution. Now, in this case, the version number, the major or the minor changes. So the build and the version become zero. So we would have to have version number 1100, version 21200, version 2000.
Now, creating patches cloning solutions, it is not recommended. The reason for this is it limits team development and it increases complexity. So Microsoft doesn’t recommend that. They would say that instead, if you want to update solutions, you can do so and then when you import them, you should then use the upgrade option.