Andrus
Andrus

Reputation: 27899

How to install OData support in ASP.NET MVC4

MVC4 Web API in .NET 4 is used in Visual Studio Community Edition .

Web API controller which accepts OData query string should created.

Tutorial in

http://odata.github.io/WebApi/#01-02-getting-started

recommends to add OData supoort using

Install-Package Microsoft.AspNet.Odata

I tried to install it using NuGet but got error

Could not install package 'Microsoft.AspNet.WebApi.Client 5.2.3'. 
You are trying to install this package into a project that targets 
'.NETFramework,Version=v4.0', but the package does not contain any
assembly references or content files that are compatible with that
framework. For more information, contact the package author.

Greatest version avaliable in NuGet is 5.7.0 and smallest 5.2.0

Both of them give this error.

How to install OData support in .NET 4 MVC4 ?

Upvotes: 1

Views: 578

Answers (1)

sjokkogutten
sjokkogutten

Reputation: 2095

If you are trying to install OData for .NET 4, could you try run this command?

PM> Install-Package Microsoft.AspNet.WebApi.OData -Version 4.0.30506

That should install the following dependencies:

    Microsoft.Net.Http (≥ 2.0.20710.0)
    Microsoft.AspNet.WebApi.Client (≥ 4.0.20710.0)
    Microsoft.AspNet.WebApi.Core (≥ 4.0.20710.0)
    Microsoft.Data.OData (≥ 5.2.0)

Upvotes: 2

Related Questions