System.Object' is defined in an assembly that is not referenced. You must add a reference to assembly

Jan 5, 2014 at 10:54 AM
I'm getting this error for the following ....
AspNetAuthorizer auth;
TwitterContext twitterCtx;
Error 1 The type 'System.Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. C:\Users\GPD\Documents\Visual Studio 2010\WebSites\TCOT\MasterPage.master.cs 12 19 C:...\TCOT\
Coordinator
Jan 6, 2014 at 6:12 AM
Hi,

You need .NET 4.5 or later for v3.0. You can use v2.1.11 with earlier versions.

@JoeMayo
Mar 29, 2014 at 9:10 AM
I am using .Net 4.5 and get the same error. There is no System.Runtime if I try to add a reference in my project.
Coordinator
Mar 30, 2014 at 5:17 AM
ProNotion,

If I recall, the closest I came to reproducing this was with an ASP.NET with a 4.0 profile, which is what prompted the previous recommendation to ensure working with a 4.5 or later profile. If that isn't the problem then I don't know unless I can reproduce the problem.

That said, here's the approach I would take if my project was producing the error you're seeing. The downloadable source code has a project named Linq2TwitterDemos_AspNet. If that runs for you, then you can use that to find the diff between that the project you're having problems with.

@JoeMayo
Jun 2, 2014 at 4:31 PM
I had the same problem in my ASP.NET MVC project, this was the solution: http://www.lyalin.com/2014/04/25/the-type-system-object-is-defined-in-an-assembly-that-is-not-reference-mvc-pcl-issue/

Change the following line in web.config:
<compilation debug="true" targetFramework="4.5"/>
to:
<compilation debug="true" targetFramework="4.5">
 <assemblies>    
  <add assembly="System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />  
 </assemblies>
</compilation>
Marked as answer by JoeMayo on 6/2/2014 at 9:09 PM