Thursday, June 13, 2013

Problems Installing Sitecore ECM 2.1

So I got to install Sitecore ECM, the Email Campaign Manager, which should work perfectly from Sitecore version 6.6 and forward.

In my test I simply installed Sitecore 7 from the Sitecore web application installer. From there on I setup the DMS (Digital Marketing System) which also is a prerequisite to run ECM.

When I had the ECM 2.1 installed correctly, I simply performed a smartpublish (as described in the installation instruction guide) and thought it was time to take a look at the module.

My dissappointment was huge when ECM failed to simply load from the "All Applications" menu.

I got an error stating that the newtonsoft.json.dll was not present in the correct version (3.5):


Could not load file or assembly 'Newtonsoft.Json, Version=3.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.IO.FileLoadException: Could not load file or assembly 'Newtonsoft.Json, Version=3.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)




I double-checked this and was not surprised that the newtonsoft.json.dll in my bin folder was actually a much later version (ver. 4.5.x).

Now my question was - how could Sitecore let this bug through? It was a standard installation, I didn't do anything fancy. I couldn't even just start the module? But wait, my frustrations got bigger :/

I then downloaded the newtonsoft.json.dll in order to comply with the demands of the ECM module. I renamed my existing dll in order to neutralize it temporarily, I pasted the newly downloaded dll into the bin folder and refreshed Sitecore. I almost got happy: the ECM module loaded as intended.
But only to disappoint me further. When I tried to create the simplest flow to test-send an email I ran into further issues. When I attempted to edit the text for the test-email to send, I got a new exception. BAM!

This time it stated the reverse problem:
the newtonsoft.json.dll was not present in version 4.5.x. No it isn't I just neutralized it in order to comply with the other darn errormessage aaarrrgh :S

The solution was to add a section of configuration to web.config:

<runtime>
  <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
    <dependentAssembly>
  <assemblyIdentity name="Lucene.Net" publicKeyToken="85089178b9ac3181" />
  <bindingRedirect oldVersion="0.0.0.0-2.9.4.0" newVersion="3.0.3.0" />
    </dependentAssembly>
    <dependentAssembly>
  <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" />
  <bindingRedirect oldVersion="0.0.0.0-3.5.0.0" newVersion="4.5.0.0" />
    </dependentAssembly>
  </assemblyBinding>
</runtime>

This configuration information tells the compiler to look for a newer version of the missing assemblies.

Strange that this is an issue in the first place. Secondly it should at least have been handled simply by submitting the information above as part of the installation instruction.

Well I hope we will get there some day :)

Upgrading to Sitecore 7

I have been in charge of upgrading our company Sitecore 6.5 rev. 110818 to Sitecore 6.6 in order to get the chance to use ECM 2.0. My first estimate on the task was purely based on documentation from Sitecore and knowledge about our internal development processes.

 I then came to learn that Sitecore 7 was just around the corner, and a tech-pub arragement by Sitecore on May 31st 2013 convinced me to take on this version instead of the 6.6 update 5. The main reason for the choice to upgrade to Sitecore 7 directly was that I was assured by members of the Sitecore-team behind the Sitecore 7 development, that the upgrade was merely a developer-centric feature-upgrade (not a very common thing in the Sitecore world), meaning that the new Linq provider, the item-buckets and the pluggable search was the only actual add-on of the upgrade (plus a few bugfixes).
 Of course we wanted to get hold of these features as well and therefore pursued the version 7.0 installation. 

Two interesting things to note though:

  1. Sitecore 7 is built targetting .net 4.5 
  2. The IIS application pool must be changed to run 4.5 in order to run the new site

Sitecore 7 on .net 4.5

This change means that you need to upgrade your Visual Studio Solution to VS 2012 (if your solution is based on Visual studio 2010 or lower), because you are not able to target 4.5 in VS 2010
Not that the installation of VS 2012 it-self was a problem for me personally - I have already made the transition to VS 2012 long ago - but the virtual machine the development-solution was using was not compatible with VS 2012 !

IIS application-pool on 4.5

This might turn out to be a problem for you if third-party DLLS are not able to run under this configuration.

Recommendation

Upgrade your solution to VS 2012 prior to installing the Sitecore 7 upgrade and making the necessary changes to your solution. This will enable you to address the problems one at a time and not pile up all the challenges you are facing.

Conclusion

Be sure that you are able to upgrade your solution to VS 2012 prior to the Sitecore 7 installation.

Hope that the description above will help you do a better estimate on your upgrade and help you be better prepared for the task.