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=5.2.3.0 Cultu.... used by Episerver.Cms,AspNet matches identity System.Web.Mvc, Version=5.2.6.0... you may need to supply runtime policy.
We have this in web.config
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:
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):
<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 to know when an EPiServer build is available that fixes this error message without having to download each version to inspect it.</p>
#194674
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.