November Happy Hour will be moved to Thursday December 5th.

Jonas Lindau
Apr 30, 2013
  10717
(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
Optimizely SaaS CMS + Coveo Search Page

Short on time but need a listing feature with filters, pagination, and sorting? Create a fully functional Coveo-powered search page driven by data...

Damian Smutek | Nov 21, 2024 | Syndicated blog

Optimizely SaaS CMS DAM Picker (Interim)

Simplify your Optimizely SaaS CMS workflow with the Interim DAM Picker Chrome extension. Seamlessly integrate your DAM system, streamlining asset...

Andy Blyth | Nov 21, 2024 | Syndicated blog

Optimizely CMS Roadmap

Explore Optimizely CMS's latest roadmap, packed with developer-focused updates. From SaaS speed to Visual Builder enhancements, developer tooling...

Andy Blyth | Nov 21, 2024 | Syndicated blog

Set Default Culture in Optimizely CMS 12

Take control over culture-specific operations like date and time formatting.

Tomas Hensrud Gulla | Nov 15, 2024 | Syndicated blog