Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compilation error at runtime from Microsoft.AspNet.WebApi.HelpPage version 4.0.30506

Tags:

I am getting the following error when I try to use version 4.0.30506 (unfortunately we are tied to this version of ASP.NEt Web API for now) of the Microsoft.AspNet.WebApi.HelpPage nuget package. I am using Windows 7 and .NET 4.5.

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=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.

Source Error:


Line 11: 
Line 12:     // Group APIs by controller
Line 13:     ILookup<string, ApiDescription> apiGroups = Model.ToLookup(api => api.ActionDescriptor.ControllerDescriptor.ControllerName);
Line 14: }
Line 15: 

enter image description here

As far as I can see I have all the correct references for this to work. I have tried looking for a System.Runtime assembly as it suggests, but I can't find it on my system. I have added using statements to the top of Index.cshtml, but with no affect.

@using System
@using System.Runtime

Any suggestions of what is causing this error?

like image 620
Jim Jeffries Avatar asked Dec 05 '13 10:12

Jim Jeffries


2 Answers

check your web.config:

<compilation debug="true" targetFramework="4.5">
    <assemblies>
        <add assembly="System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
    </assemblies>
</compilation>
like image 179
giammin Avatar answered Oct 19 '22 18:10

giammin


In my case, this error disappeared when I removed System.Collections.Immutable.dll from Bin directory. This DLL is from NuGet package and is available only for Win8 platforms and I was working with Win7. So it might help you too..

like image 20
Lukas Dvorak Avatar answered Oct 19 '22 19:10

Lukas Dvorak