HJain
HJain

Reputation: 145

The type or namespace 'OData' does not exist in the namespace 'Microsoft.AspNetCore'

I am building a .Net Core OData interface.

I am trying to use the namespace 'Microsoft.AspNetCore.OData' but it throws the error saying 'The type or namespace 'OData' does not exist in the namespace 'Microsoft.AspNetCore'.'

Also, I have downloaded the package 'Microsoft.AspNetCore'.

The question is: 1. Can I use Microsoft.AspNet.OData instead of 'Microsoft.AspNetCore.OData'. Would that affect my OData implementation in .net core?

Thank you.

Upvotes: 4

Views: 3492

Answers (2)

Syed Nasir Abbas
Syed Nasir Abbas

Reputation: 1857

Please use

using Microsoft.AspNet.OData;

instead of

using System.Web.OData;

Upvotes: 2

Shaun Luttin
Shaun Luttin

Reputation: 141682

Try this:

cd C:/temp
dotnet new web  
dotnet add .\temp.csproj package Microsoft.AspNetCore.OData --version 7.0.0-*

That lets us use the following using statement.

using Microsoft.AspNet.OData;

Upvotes: 2

Related Questions