The type or namespace name 'OpenIdConnectOptions' could not be found while upgrading my ASP.NET Core 2.2 to 3.1

1.2k Views Asked by At

I am trying to upgrade my ASP.NET Core 2.2 to 3.1 but getting below error. Not Sure how to resolve it.

I am getting below error

Severity Code Description Project File Line Suppression State Error CS0234 The type or namespace name 'OpenIdConnect' does not exist in the namespace 'Microsoft.AspNetCore.Authentication' (are you missing an assembly reference?)

Severity Code Description Project File Line Suppression State Error CS0246 The type or namespace name 'OpenIdConnectOptions' could not be found (are you missing a using directive or an assembly reference?)

Severity Code Description Project File Line Suppression State Error CS1061 'AuthenticationBuilder' does not contain a definition for 'AddOpenIdConnect' and no accessible extension method 'AddOpenIdConnect' accepting a first argument of type 'AuthenticationBuilder' could be found (are you missing a using directive or an assembly reference?)

Error CS0006 Metadata file 'C:....\bin\Debug\netcoreapp3.1\aa.dll' could not be found

I have this using directive in my solution.

using Microsoft.AspNetCore.Authentication.OpenIdConnect
1

There are 1 best solutions below

0
On

run the following in your Package manager console

Install-Package Microsoft.AspNetCore.Authentication.OpenIdConnect -Version 6.0.4

For .Net 6