Search code examples
c#asp.netasp.net-mvc-5asp.net-mvc-views

System.Web.HttpCompileException:The type '<>' is defined in an assembly that is not referenced


Found this error just after upgrading the .NET framework to 4.7.2:

System.Web.HttpCompileException: some.cshtml(95): error CS0012: The type 'IEnumerable<>' is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.'

Where should I add the reference?


Solution

  • Found at at github. Add the following to the web.Config file:

    <compilation debug="true" targetFramework="4.7.2" >
      <assemblies>
        <add assembly="netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51"/>
      </assemblies>
    </compilation>