Follow the path : Upgrading Umbraco from V4 to V7
Recently I was required to refresh a website that
I developed around two years ago for one of our clients. Like many
of our sites this was developed upon our favourite content
management system, Umbraco. The
Umbraco platform is continually evolving and has gone through a
significant number of iterations over the last few years, some
good, some not so good.
I've developed sites in pretty much every stable release over
the past three years, including the short lived Umbraco 5, however
it's rare that I've needed to undertake an Umbraco
upgrade.
For some reason call it brave or stupid but this
latest project seemed like the ideal opportunity to see how simple
the process really is. I already had an up-to-date development copy
of the site with a development database so what did I have to
lose...
For anyone embarking on a similar challenge I
thought it worthwhile to outline the pitfalls and experiences I had
during the process and more importantly share the resources that
allowed me to successfully upgrade from 4.7.1 to 7.1.2.
Prior to the introduction of the new Belle user
interface (UI), the team at Blix had refined the out-of-the-box and
very dated Umbraco UI with a simple but effective replacement.
Other than the enhanced UI the install I'm discussing here is a
standard Umbraco 4.7.1 build with very few packages installed. I
would think twice before upgrading any site that has more packages
and bespoke development as this is where you are likely to start
running into difficulties.
One step at a time
Unfortunately the main issue with upgrading
Umbraco is that you cannot jump straight from one version to
several versions in the future. I used the upgrade paths suggested
on Lee Kelleher's site (http://code.leekelleher.com/umbraco/archive/).
Which for me was:
4.7.1 » 4.7.2 » 4.8.1 » 4.9.0 » 4.11.1 »
4.11.3.1 » 6.0.0 » 7.1.2
Umbraco is kind enough to have all historical releases on
the Umbraco community site and also provides guidance on
upgrading Umbraco alongside any
version specific steps. Before starting the upgrade make sure
you know your upgrade path and have read the various upgrade guides
and always do this on a development site! I would also point out
that you need to make sure you are logged out of the Umbraco CMS
prior to each upgrade as this caught me out with a YSOD(yellow
screen of death) during one of the upgrades.
The process
Upgrading 4.7.1 to 4.7.2 was a fairly smooth process, download
the 4.7.2 release, copy across the /bin, /install, /umbraco and
/umbraco_client folders. I downloaded and installed WinMerge and then compared each of
the files within the /config folder. Fortunately this Umbraco
instance was a fairly vanilla build and there were very few
modifications made in the various config files and any that had
been made I was happy to overwrite in the name of simplicity. So I
proceeded to copy across the 4.7.2 /config folder then loaded up my
site and let Umbraco do its thing. Success Step 1 was issue free
and I was one step closer!
With no need to compare the config files as I had overwritten
any changes in the previous upgrade I was able to complete the next
4 upgrades fairly effortlessly:
- Download upgrade release
- Copy /Config, /Install, /Umbraco, /Umbraco_client and /bin
folders
- Load the site and let Umbraco update the database where
required.
There are a couple of version specific steps I had to
undertake:
4.7.2 to 4.8.1
- Delete /bin/app_browsers.dll
- Delete /bin/app_global.aspx
4.9.0 to 4.11.1
- Delete /bin/umbraco.linq.core.dll
- Copy across /App_plugins
- Copy across /Views
- Delete /Config/formHandlers.config
I now successfully had a 4.11.1 version of Umbraco up and
running!
Next step 4.11.1 to 6.0.0 : As before copy /Config, /Install,
/Umbraco, /Umbraco_client and /bin folders. In addition I now
needed to copy across the new global.asax file.
At this point I had another YSOD a quick check in WinMerge with
the current and 6.0.0 release web.config files showed a handful of
library references that needed updating. Up until now the
web.config file had been untouched by me. You will need to go
through line by line to check you copy across the updated
references that are required. With a bit of luck that had fixed the
YSOD and once completed I was able to load the site and let Umbraco
do its various database upgrades.
There were a few issues I had noticed, but now its time to
install the Path
fix-up
package. I couldn't install this directly from the Umbraco
Package repository so had to download the zip file and install it
from the downloaded file. Once installed you will see a new tab in
your developer area called Utilities and a button to 'Fix Paths'.
Click the button and the package will clean up any inconsistencies
and fix any database issues. This was 6.0.0 up and running, time
for a coffee before the final upgrade.
Almost there
This is the big one 6.0.0 to 7.1.2! There is a page dedicated to
the
7 upgrade process on the umbraco site that's also worth a read.
So as I'd already done 7 times before I copied the /Config,
/Install, /Umbraco, /Umbraco_client and /bin folders along with the
/global.asax file from the 7.1.2 build. There are a few additional
steps before we are ready to run the site:
- Delete /bin/Our.Umbraco/uGoLive.47x.dll
- Delete /bin/Our.Umbraco/uGoLive.checks.dll
- Delete /bin/Our.Umbraco/uGoLive.dll
- Copy /macroscripts/web.config
- Copy /views/web.config
- Delete /Config/xsltExtensions.config
There is a lot to do in the web.config file now so again load
the two in WinMerge. One of the big changes is the database
connection which moves into <connectionStrings>. In addition
below is the list of changes suggested on the
Umbraco 7 upgrade guide but you will need to compare the files
in WinMerge to make sure you have everything correct:
- remove <section name="BaseRestExtensions"> section
- remove <section name="FileSystemProviders"> section
- remove <sectionGroup name="system.web.webPages.razor">
section
- remove <<FileSystemProviders > element
- remove <BaseRestExtensions > element
- remove <add key="umbracoUseMediumTrust" > element
- remove <system.web.extensions> element
- removes <xhtmlConformance > element
- remove <system.codedom> element
- remove <compilation> <assemblies *>
</compilation>
- remove <system.web.webPages.razor > element
- new <sectionGroup name="umbracoConfiguration">
section
- new <umbracoConfiguration> element
- ensure that the targetFramework="4.5" is added to the
<httpRuntime> element
- add <add key="ValidationSettings:UnobtrusiveValidationMode"
value="None" /> to the appSettings element
All being well you should now be ready to load your site and
start the database upgrade. I quickly ran into issues with the
database upgrade. Fortunatly I found a
forum discussion on Our.Umbraco.org where several people were
having similar issues and used the following fixes to get me moving
again.
Fix 1
ALTER TABLE [dbo].[cmsMacroProperty] drop
CONSTRAINT [DF_macroProperty_macroPropertyHidden]
GO
ALTER TABLE [dbo].[cmsMacroProperty] ADD
CONSTRAINT [DF_cmsMacroProperty_macroPropertyHidden] DEFAULT
('0') FOR [macroPropertyHidden]
GO
Fix 2
ALTER TABLE [dbo].[cmsMacroProperty] WITH
CHECK ADD CONSTRAINT
[FK_cmsMacroProperty_cmsMacroPropertyType_id] FOREIGN
KEY([macroPropertyType])
REFERENCES [dbo].[cmsMacroPropertyType] ([id])
GO
ALTER TABLE [dbo].[cmsMacroProperty] CHECK
CONSTRAINT [FK_cmsMacroProperty_cmsMacroPropertyType_id]
GO
Fix 3
ALTER TABLE [dbo].[cmsMacroProperty] DROP
CONSTRAINT [FK_umbracoMacroProperty_umbracoMacroPropertyType]
GO
Fix 4
ALTER TABLE [dbo].[cmsTagRelationship] WITH
CHECK ADD CONSTRAINT [FK_cmsTagRelationship_umbracoNode_id] FOREIGN
KEY([nodeId])
REFERENCES [dbo].[umbracoNode] ([id])
GO
ALTER TABLE [dbo].[cmsTagRelationship] CHECK
CONSTRAINT [FK_cmsTagRelationship_umbracoNode_id]
GO
One by one I ran the 4 fixes and hey presto the database upgrade
was successful!. There are several code changes within the
macro's/master templated, that now can be transferred into Partial
Views and tidied up but mostly a 4.7.1 Umbraco site was up and
running in Umbraco 7.1.2!
Worth the wait
There are lots of steps and it takes time but the whole process
was all in all surprisingly smooth but worth the effort because
Umbraco version 7 is such a significant improvement.
Of course I benefited from the fact there we no critical
packages installed and the initial build was very little more than
a vanilla Umbraco instance. Time will tell if there any strange
quirks but so far so good!
Every umbraco instance is different I imagine that next time I
try this it might not be as plain sailing but I pleased to have
completed the upgrade on this site at least. There is a great Umbraco community out there and
most issues you come across have been experienced before and google
will be a useful assistant!
Posted By
Simon Campbell Filed under
Umbraco,
Dev Tips on
About the author
Simon brings nearly two decades of software development
experience to the team and is a full-stack Microsoft developer with
an innate understanding of complex systems and an eye for
detail.
As the "Campbell" in Campbell Sauvarin Photography Simon also
adds professional photography skills to the mix of skills at Blix
HQ.