Performing an upgrade from Sitecore 6.0 to 6.5

Recently, I was given the task to perform an upgrade of an old Sitecore 6.0 installation all the way up to Sitecore 6.5 with DMS. A really good idea, I might add, since lots of good stuff has been added to the cms since good ol’ 6.0. However, as all developers, I’m lazy, so I after having looked at SDN, the recommended upgrade path was like this:

  • Sitecore 6.0.1 rev. 090212
  • Sitecore 6.1.0 rev. 090630
  • Sitecore 6.2.0 rev. 091012
  • Sitecore 6.3.0 rev. 100716
  • Sitecore 6.4.0 rev. 101012
  • Sitecore 6.5 (finally!)

Along with update packages, a lot of tedious changes to the configuration would have to be made, so I made the decision to skip the recommended way.

Enter serialization and packages!

In 6.0, the serializer had some problems with star-items, so I had to resort to use the packager for the content tree, but otherwise, I was capable of moving items from the 6.0 solution and import them into the 6.5 solution.
To ensure that I did not overwrite any new items in the 6.5 solution by reverting from the serialized items, I began the whole procedure with serializing the entire tree in the Sitecore master database and copied in the customer-specific items from the 6.0 solution. As there were quite a lot of content items, I integrated Alex Shyba’s nice post on how to disable the lucene index while installing large packages.

The core database

The 6.5 solution was installed with a vanilla 6.5 core database, so I had to apply modifications from the 6.0 database. In this case, the following things needed to be migrated and updated to fit 6.5:

  • User profiles
  • HTML Editor profiles

Finally, I used SQL Management Studio to copy the contents from the ASP.NET tables (containing users, profiles, roles etc) to keep the users. Configuration In the old solution, web.config was modified and the include file method was not being used, so I took the vanilla web.config from 6.5 and performed the changes that existed outside the Sitecore part of the file and created include files to contain the customizations.
The good thing about this approach is that it makes it considerably easier to do the next upgrade.

Gotcha’s

Of course this could not be done without a number of small hickups:

  • It was not possible to use the page editor, since all layouts were placed directly on the templates instead of on the __Standard Values item.
  • The forms database scheme in the sqlite database from the Webforms for Marketers module had changed, so it was no longer possible to use the database file.

Read Excel files the easy way on Windows Server 2008 R2 64-bit

Here’s a quick one. I once had to do some importing from an Excel-sheet in .NET 4.0, running on a 64-bit server. It is really trivial, so I’ll only post the two things that I had to look for (which apparently can be hard to find on the ‘net).

First of all, you’ll need the Microsoft Access Database Engine runtime for 64-bit:
http://www.microsoft.com/downloads/en/details.aspx?FamilyID=c06b8369-60dd-4b64-a44b-84b371ede16d

The connection string to use looks like this:

string connectionString = string.Format("Provider=Microsoft.ACE.OLEDB.12.0; data source={0}; Extended Properties=\"Excel 12.0;HDR=YES;-\"", fileName);

The fileName variable must be an absolute path to an excel file.

The code to use it could look something like this:

OleDbDataAdapter adapter = new OleDbDataAdapter("SELECT * FROM [Items$]", connectionString);
 
DataSet ds = new DataSet(); 
adapter.Fill(ds); 
foreach (DataTable table in ds.Tables)
{
    Console.WriteLine(table.TableName);
} 
 
DataTable itemsDataTable = ds.Tables["Table"];

Sitecore 6 auto-serialization

When working on larger solutions based on Sitecore, I sometimes tend to forget to serialize the items I’ve been working on.

The following xml can be inserted into an include-file, and will make Sitecore perform serialization of all elements that gets touched when you work on them.

   1: <configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
   2:     <sitecore>
   3:         <events>
   4:             <event name="item:saved">
   5:                 <handler type="Sitecore.Data.Serialization.ItemHandler, Sitecore.Kernel" method="OnItemSaved"/>
   6:             </event>
   7:             <event name="item:deleted">
   8:                 <handler type="Sitecore.Data.Serialization.ItemHandler, Sitecore.Kernel" method="OnItemDeleted"/>
   9:             </event>
  10:             <event name="item:moved">
  11:                 <handler type="Sitecore.Data.Serialization.ItemHandler, Sitecore.Kernel" method="OnItemMoved"/>
  12:             </event>
  13:             <event name="item:versionRemoved">
  14:                 <handler type="Sitecore.Data.Serialization.ItemHandler, Sitecore.Kernel" method="OnItemVersionRemoved"/>
  15:             </event>
  16:         </events>
  17:     </sitecore>
  18: </configuration>