Try our conversational search powered by Generative AI!

Problem with mismatching assemblies for System.Web.Mvc


In a project where we upgraded to latest version of System.Web.Mvc we get this varing in the Razor views

Assuming assembly reference 'System.Web.Mvc, Version= Cultu.... used by Episerver.Cms,AspNet matches identity System.Web.Mvc, Version= you may need to supply runtime policy.

We have this in web.config

May 31, 2018 15:49

Could it be that you need to update version references in Views/web.config?

May 31, 2018 15:55

Having the same issue, did you find a solution?


Jun 13, 2018 16:25

I get students on the CMS developer courses to fix that error using the following, but if anyone finds a better solution, please let me know!

Suppressing compiler warning CS1702

The EPiServer assemblies are currently compiled for Microsoft.AspNet.Mvc 5.2.3 but you are probably using a later version like 5.2.4. This causes compiler warnings when Razor views are open if they call Episerver extension methods like PropertyFor(). Until Episerver releases new assemblies, you can suppress the CS1702 warning by adding the following to the root Web.config:


    <compiler language="c#;cs;csharp"



                   type="Microsoft.CSharp.CSharpCodeProvider, System, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089"


      <providerOption name="CompilerVersion" value="v4.0" />

      <providerOption name="WarnAsError" value="false" />



Jun 13, 2018 17:29

Thanks Mark, I have no better solution and this works!

Jun 15, 2018 9:02
<p>How can I determine which version of&nbsp;<span>Microsoft.AspNet.Mvc a given version of EPiServer is built on? I don't see it listed as a dependency for the EPiServer.CMS Nuget package.</span></p>
Jun 23, 2018 0:55

Hi Jesse, you can use .Net framework tool ILDASM.exe to look at any assembly (dll or exe) what are the "exact" references. Open developer command prompt and type: ildasm (hit enter naturally to execute ;P). Then in the app File -> Open (and select you assembly, for example episerver.cms.aspnet.dll) and then double click the "manifest" and from that list you can see the "exact" reference version.


Another option would be to use for example third party application ILSpy to look at the assembly references.


Episerver Microsoft.AspNet.Mvc NuGet dependency is in the EPiServer.Framework.AspNet NuGet package and defined like this (but means I will work with this version range, but not I'm built with these versions):

<dependency id="Microsoft.AspNet.Mvc" version="[5.2.3, 6.0.0)" />
Edited, Jun 25, 2018 22:11
<p>Thanks, Antti! I've done this with ILSpy, but didn't know how to do it with IL Disassembler so thanks for the walkthrough. However, I'm wondering how I can determine it without having the assemblies. I want&nbsp;to know when an EPiServer build is available that fixes this error message without having to download each version to inspect it.</p>
Jun 27, 2018 22:44

Hi Jesse,

The EPiServer.Framework.AspNet package, which EPiServer.CMS.AspNet depends on, lists Microsoft.AspNet.Mvc as one of its dependencies, so you could just look there.

Nov 26, 2018 14:56
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.