14 July 2015 PCL, ASP.NET Robert Muehsig

Weird Error Message:

Compilation Error

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS0012: The type ‘System.Object’ is defined in an assembly that is not referenced. You must add a reference to assembly ‘System.Runtime, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’.


Put this Assembly-Reference in the web.config:

<compilation debug="true" targetFramework="4.5">
        <add assembly="System.Runtime, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />


This error occures when you are using Portable Class Libraries (PCLs) inside ASP.NET Projects. This Blogpost provides a pretty good answer. In short: It’s an issue between runtime and build time - PCLs that are used in Razor are runtime stuff.

I (re-)blogged this because I had this issue more than once ;)

Hope this helps!

Written by Robert Muehsig

Software Developer - from Saxony, Germany - working on primedocs.io. Microsoft MVP & Web Geek.
Other Projects: KnowYourStack.com | ExpensiveMeeting | EinKofferVollerReisen.de