This week I was tasked with an upgrade and migration. Migration to the Umbraco Cloud after upgrade from 7.2.6 to 7.12.3 – that’s 3 years of upgrades!
This was a pretty large site but not that complicated, most of the code existed in the views only – and old school to boot. No models builder as the site was pre-models builder Umbraco shipping, lots of dynamic stuff and a sprinkle of hard coded id’s – a no-no on the Cloud!
I outline the steps and some of the tricks I found along the way in the hope that this will help someone in the near future who has to perform a similarly gargantuan upgrade.
Please excuse the terse step by step – but I didn’t want to write war and peace!
Get a .BAK of the DB and get all the site files from the previous developer (not always as straight forward as it should be 🙂
Restore the DB to your local SQLServerExpress instance and create a dbowner privileged user and assign your restored DB.
Find out the version of the site you are to upgrade. Goto the existing site wherever it is and then select the question mark at the bottom left of the menu – ? – version no. will be shown.
So, on this occasion the site was 7.2.6
Start a blank VS project: Visual Studio > File > New Project > Visual c# > ASP.NET Framework Web Application (.NET Framework) > Empty (and tick the MVC checkbox)
Right click the solution in Solution Explorer > Manage Nuget Packages for Solution
Select Browse and search for UmbracoCMS
Select your project name to install to (there is only the one project presently) and MAKE SURE YOU SELECT SAME THE VERSION of UmbracoCMS to install that your origin site utilises – in this case 7.2.6
Takes a while to install …
Hit play and Run the site in Debug mode, takes a while to build … … …
Say OK to ‘Modify Web.Config file to enable debugging’
When presented with the Install Umbraco 7 screen enter your name and email and password and SELECT CUSTOMIZE – otherwise you’ll get a starter site installed
When asked What type of database do you use LEAVE AS Microsoft SQL Server Compact (this is going to help with a little trick shortly!)
Answer No thanks I do not want to install a starter site
Sit back and make a cup of tea…
Here’s a trick! Let’s assume you don’t know the admin pwd to the CMS of the origin site – here’s how to get into it quickly.
When the CMS comes up go back to VS
Stop the solution
Edit the web.config and place your SQL connection string in as created above
Run the solution again and it will log you in as Administrator straight away (the first Administrator it finds I believe – or perhaps the creator of the site once more) – I believe this is because the cookie is still set for that url and port?
As you are logged in – create your own new User with admin privileges. Log out, then Log in to make sure all is OK.
So now we have a 7.2.6 clean install pointing to the origin database. Let’s get the site working on this install with this database.
In your origin site directories and files identify those that make up the site at root level, i.e. not folders which make up the CMS but those used to make up the site from a custom perspective. In my case it was…
Paste these over your solution in File Explorer
Run the site again and log into the CMS
Republish the Entire Site from the Content node
Hey Presto! Your CLEAN 7.2.6 site with DB and site files
At this point make a copy of the VS repo directory – so you can always go back to your origin if something goes awry when upgrading
Now for the upgrade – we like to do it in baby steps – seems we get more success this way.
For each upgrade refer to this page for individual notes and make sure you follow any instructions: https://our.umbraco.com/documentation/getting-started/setup/upgrading/version-specific
REMEMBER THIS TOO! When upgrading your website use NuGet and answer “No” to the questions to overwrite the Web.config file (and config files in the config folder).
I went 7.3.0, 7.4.0., 7.5.0, 7.6.0 – no issues – test CMS and front end on each upgrade
At 7.6.0 I commented out all lines to do with urlRewriting as per the guide above
At 7.7.0 there is a switch to use email as the login name
At 7.8.0 I had to run the script found here (as others did and noted in posts) https://our.umbraco.com/forum/using-umbraco-and-getting-started/90585-upgrade-from-7711-to-78x-database-missing-keys-fk_cmsmedia_cmscontent_nodeid
7.8.0, 7.9.0, 7.10.0, 7.11.0, 7.12.0, 7.12.3 – no issues
Next – before anything else – Go find all the Developer > DataTypes in the local site CMS that are now obsolete and simply rename them Original Name – Obsolete. Why? Because they have the same names as the new datatypes which have replaced them. But you still need them as your site still uses the obsolete ones! When all is done you will end up with the Obsoletes alongside the new ones and your site will still work! This is knowledge gleaned from trial and error over previous attempts. Remember you are only changing the name of the picker!
Content Picker – becomes Content Picker Obsolete
Folder Browser – becomes Folder Browser Obsolete
Media Picker – becomes Media Picker – Obsolete
Member Picker – becomes Member Picker – Obsolete
Multimedia Picker – becomes Multimedia Picker – Obsolete
Related Links – becomes Related Links – Obsolete
OK – so now we have a fully up to date local site with those obsolete datatypes renamed – Let’s get the site onto the cloud – follow this guide to the letter https://our.umbraco.com/documentation/Umbraco-Cloud/Getting-Started/Migrate-Existing-Site/
So now you’re all hooked up and ready to deploy fixes to issues that will break the site now it’s on the cloud.
Find all uses of hard coded ID’s and for a quick fix do as below and then reference the [your variable name]Id value rather than the id value directly.
Use the UID which is the same across installations on the cloud to get the ID that was previously directly referenced. This id will be different on each install – ie. Local, stage, live – but the UID is the same
var [your variable name]Id = Umbraco.TypedContent(“[your item GUID found in the CMS info tab]”).Id;
Then instead of code that used to say something like
if(item.id != 1069)
if(item.id != [your variable name]Id)
Finally - Weird Stuff
Weird stuff 1: Rebuild all the indexes – on the live site. I found that because my old site used dynamics all over the place that until I rebuilt the indexes none of the images were showing on the cloud site.
Weird stuff 2: The forms in the origin install file set I had were placed in the App_Plugins folder but NOT in the App_Data folder. I pasted a copy of the UmbracoForms folder across to the AppPlugins folder and all appeared in the CMS locally – then I deployed to cloud and they worked off the bat.
Good Luck with your next upgrade!
Drop us a line if you need any further info, advice or support from our expert Umbraco certified developers