The type 'ValueType' is defined in an assembly that is not referenced

  • Page Owner: Not Set
  • Last Reviewed: 2020-01-27

The type 'ValueType' is defined in an assembly that is not referenced.

D:\home\site\wwwroot\Features\Apta\Pages\ArticlePage\index.cshtml(134): error CS0012: The type 'ValueType' 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'.

This is actually a more obscure error on DXC sites. What can I do to fix it?


Additional Posts

WELL when I encountered this error I had not set up a Blob or Event provider for DXC.

See Step 2 on this page: https://world.episerver.com/digital-experience-cloud-service/deploying/creating-a-new-cms-site-and-deploying/

This solved the issue for me and is likley the cause although that error is pretty generic and this may not fix it for you. Worth a shot though.

After some deeper digging, I found this happened after switching the project from 4.8 to 4.7.2. To fix this update your web config as follows:

 <system.web>
    <customErrors mode="Off" />
    <compilation debug="true" targetFramework="4.7.2">
      <assemblies>
        <add assembly="netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51" />
      </assemblies>
    </compilation>
  ...
 </system.web>

Comments

  • My guess is that you have a library build on netstandard referenced somewhere. I guessing that in .NET 4.8, netstandard is basically included in the runtime. In older versions, you must specifically include a reference -- something like that.