添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

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:
<system.codedom>

  <compilers>

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

              extension=".cshtml"

              compilerOptions="/nowarn:1702"

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

              warningLevel="4">

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

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

    </compiler>

  </compilers>

</system.codedom>

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)" />
<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> #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.

#199409 Nov 26, 2018 14:56
* 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.

Optimizely support

See the support page for contact information.

Feedback on Optimizely World

If you’d like to give feedback about this site, please click here . Thank you very much!