Flezcano
Flezcano

Reputation: 1687

System.Web.OData not defined when installing Microsoft.AspNet.Odata

I am trying to follow this Microsoft tutorial with no luck. https://learn.microsoft.com/en-us/aspnet/web-api/overview/odata-support-in-aspnet-web-api/odata-v4/create-an-odata-v4-endpoint . I created the web api project on visual studio 2017, and runned "Install-Package Microsoft.AspNet.Odata" on Package Manager Console, but I still get System.Web.OData namespace undefined ("The type or namespace Odata does not exist on 'System.Web'"). Any clue why is this happening?. The version of Odata installed is 7.0.1. Should I get another version?

Upvotes: 4

Views: 6090

Answers (2)

Bondolin
Bondolin

Reputation: 3121

See https://github.com/Microsoft/aspnet-api-versioning/issues/315:

With Microsoft.AspNet.OData v7.0, namespaces were changed from System.Web.OData to Microsoft.AspNet.OData.

Upvotes: 5

Siri How
Siri How

Reputation: 143

I found Microsoft.AspNet.OData 7.0.0 or above (even though 7.0.1 or 7.1.0) doesn't contain System.Web.Odata. You can install Microsoft.AspNet.OData 6.1.0 then System.Web.Odata will be auto-added under reference.

Install-Package Microsoft.AspNet.OData -Version 6.1.0

Upvotes: 1

Related Questions