Jonas Lindau
Apr 30, 2013
  10771
(0 votes)

The annoying “error CS1031: Type expected” after upgrade site from CMS5R2 to CMS6

A few days ago a colleague upgraded a EPiServer site using Deployment Center and got this strange error. According to the dump the error was related to /Shell/Views/Shared/Site.Master. I knew the site was working correctly on my development machine, and I also knew the site was working fine in the test environment, so I ruled out any code-issues. Since there was already a lot of sites running on the production servers I also ruled out any missing dependencies. So what’s left? The Web.config of course!

The natural approach to find the error was to compare the non-working web.config in the production environment, with the working web.config from the test environment. That turned out to be an easy task since the only thing that was different was three lines, all which had to do with MVC!

For some reason Deployment Center didn’t care to replace the version of MVC on the production servers. It worked for the same site on my development machine and for the test servers. It also always worked for other sites on out production servers, but not this time.

So what I did was change the version numbers for System.Web.Mvc as below:

 

This is how it looked after upgrade

<dependentAssembly>
  <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" culture="neutral" />
  <bindingRedirect oldVersion="1.0.0.0-1.65535.65535.65535" newVersion="1.0.0.0" />
</dependentAssembly>

<compilation defaultLanguage="c#" debug="false">
  <assemblies>
    <add assembly="System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
  </assemblies>
</compilation>

<pages validateRequest="false" enableEventValidation="false" pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">

 

This is what I did change to make it work

<dependentAssembly>
  <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" culture="neutral" />
  <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>

<compilation defaultLanguage="c#" debug="false">
  <assemblies>
    <add assembly="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
  </assemblies>
</compilation>

<pages validateRequest="false" enableEventValidation="false" pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">

 

And the error is gone!

Apr 30, 2013

Comments

Please login to comment.
Latest blogs
How to add an Admin Mode add-on in Optimizely CMS12

How to add a new add-on with navigation and unified stylesheet

Bartosz Sekula | Jan 2, 2025 | Syndicated blog

Managing Your Graph Conventions

Recently, Optimizely released a Conventions API for manging how various fields on your CMS content are indexed by the Graph. This is an extremely...

Ethan Schofer | Dec 31, 2024

SaaS CMS and Visual Builder - Opticon 2024 Workshop Experience

Optimizely is getting SaaSy with us…. This year Optimizely’s conference Opticon 2024 took place in San Antonio, Texas. There were a lot of great...

Raj Gada | Dec 30, 2024

Copy Optimizely SaaS CMS Settings to ENV Format Via Bookmarklet

Do you work with multiple Optimizely SaaS CMS instances? Use a bookmarklet to automatically copy them to your clipboard, ready to paste into your e...

Daniel Isaacs | Dec 22, 2024 | Syndicated blog

Increase timeout for long running SQL queries using SQL addon

Learn how to increase the timeout for long running SQL queries using the SQL addon.

Tomas Hensrud Gulla | Dec 20, 2024 | Syndicated blog

Overriding the help text for the Name property in Optimizely CMS

I recently received a question about how to override the Help text for the built-in Name property in Optimizely CMS, so I decided to document my...

Tomas Hensrud Gulla | Dec 20, 2024 | Syndicated blog