I'm migrating from .net core 2.2 to 3.1 but I got this error in runtime
System.MissingMethodException: 'Method not found: 'Microsoft.Extensions.DependencyInjection.IServiceCollection Microsoft.Extensions.DependencyInjection.AuthorizationServiceCollectionExtensions.AddAuthorization(Microsoft.Extensions.DependencyInjection.IServiceCollection, System.Action`1<Microsoft.AspNetCore.Authorization.AuthorizationOptions>)'.'
I made sure that I include all the needed nuget libraries
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Authorization" Version="3.1.12" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.0-preview.2.21154.6" />
<PackageReference Include="Signed.IdentityModel.AspNetCore.OAuth2Introspection" Version="3.5.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="5.0.0" />
<PackageReference Include="Microsoft.AspNetCore.SpaServices.Extensions" Version="2.0.0" />
</ItemGroup>
I even tried adding ( not convinced it's needed)
and in startup
services.AddMvc(options => {
options.AddOAuth2AuthorizationPolicy();
});
services.AddAuthorization();
not sure what's missing