-
-
Notifications
You must be signed in to change notification settings - Fork 3
Common Issues
The error message you see is similar to:
The type 'Object' 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 has mostly been seen in new web forms projects targeting .NET 4.7 and 4.7.1.
This appears to be a bug in Visual Studio and has some discussion here: https://github.com/dotnet/standard/issues/542 and here: https://github.com/dotnet/standard/issues/481
Also, an issue in the VS Developer Community: https://developercommunity.visualstudio.com/content/problem/335717/csharpaddmissingreferencecodefixprovider-encounter.html
The easiest way to fix this is to edit your web.config (in ASP.NET WebForms websites) and add this line in system.web/compilation/assemblies
:
<add assembly="netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51"/>
So it will look like this:
<compilation debug="false" targetFramework="4.7">
<assemblies>
<add assembly="System.Data.OracleClient, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Net, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.ServiceProcess, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.Transactions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51"/>
</assemblies>
</compilation>