Oct 29

Update Umbraco from 4.0.2.1 to 4.5.2

Its been a long night here at Little Web Empire.  We decided that it would be a good time to upgrade our site from an older version of Umbraco (v4.0.2.1) to the latest stable build (v4.5.2).

The upgrade was pretty straight forward. Here's what we did.

  • Backup! First thing we did was take a backup because the last thing we wanted was to be in a position of no return with problems.
  • Download. We downloaded the Umbraco v4.5.2 from codeplex we used the .net 3.5 as our hosting provider is a little behind and has not updated the .net framework to version 4 yet.
  • Compare or follow update instrustions. We then proceeded to do a compare between the downloaded directory structure and our site. Beyond Compare from Scooter Software is really good for this amd was our tool of choice.  We did it this way rather than following the standard upgrade instructions as we had a few custom items we did not want to lose in the upgrade so comparing was our safest bet.  Main things that change are the DLLs in the bin, the Umbraco directory, the umbraco_client directory, some config files in the config directory, you will also notice that Umbraco now uses the App_Data folder for its storeage rather than the data folder. The web.config file changes also.
  • Install/Upgrade. Next you run the install step.   You may get confronted by the password challenge.  If you do there is one thing to be aware of between earlier versions of Umbraco and the later versions that the passwords are now hashed.  Because of this hashing your password will no longer work so the easy way to fix this is to modify the web.config file to tell the UsersMembershipProvider not to hash password by removing the following attribute.

    passwordFormat="Hashed"

    You should be able to login as normal after doing this.
  • XSLT Errors! Follow the upgrade wizard and it will eventually complete after a few steps.  Your database at this stage is updated and in theory the site is good to go, but if you use XSLT for anything you will notice errors all over your site.   This is because the XML schema changed with the release of version 4.5.
  • Convert XSLT. To fix XSLT errors due to schema change you have a couple of options.  You can set the schema back to the legacy one, or you can opt to use the new schema which means you will need to modify all of your XSLT files to the new format.   There are some advantages to moving to the new format such as readability and some of the newer packages disregard the old schema so we opted to go with the new schema and update the XSLT.  To aid in the update however there are XSLT schema converters available online, and we went with the one built by Tommy Poulsen. This simple page allows you to paste your old XSLT file in and get a new file out.  It worked on most things but there were some instances that required us to do manual updates, in particular it is unable to convert @nodeTypeAlias.  We had to manually change any statement the used it to something like this:

    /* [@isDoc and local-name() = 'NodeType']

    which is equivalent to /node [@nodeTypeAlias = 'NodeType']

    Hash your passwords. after we had worked through all of our XSLT and cleared all the errors we had a working site.
  • The last thing we was to turn password hashing one in the web.config while we were still logged in.   Our session remained intact so it still thought we were authenticated.   We then went to the Users section and reset the passwords for our users to save the new hashed password to the database.

And that was it.  Our site was upgraded.   Hopefully some of this is useful to others.