Standard: Issue with ValueType on net471 when use IEnumerable

Created on 24 Oct 2017  路  3Comments  路  Source: dotnet/standard

Upgrading my asp.net mvc project to .NET 4.7.1, but now this error occurs in cshtml pages, when I use IEnumerable property in my Model:

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'.

netfx-compat

Most helpful comment

I found the solution!

The big problem for lack of netstandard reference in web.config.

Error:

error-01

Solution:

Add reference for netstandard in web.config

<system.web> <compilation debug="true" targetFramework="4.7.1" > <assemblies> <add assembly="netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51"/> </assemblies> </compilation> <httpRuntime targetFramework="4.7.1" />

solution-01

Result:

result - 01

All 3 comments

I found the solution!

The big problem for lack of netstandard reference in web.config.

Error:

error-01

Solution:

Add reference for netstandard in web.config

<system.web> <compilation debug="true" targetFramework="4.7.1" > <assemblies> <add assembly="netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51"/> </assemblies> </compilation> <httpRuntime targetFramework="4.7.1" />

solution-01

Result:

result - 01

Thank you for this. This help me with a problem I've been fighting for the last few hours... ugh.

Now I just wish I new why I need to do this...

Closing as resolved

Was this page helpful?
0 / 5 - 0 ratings