services.AddRazorPages() : IServiceCollection does not contain definition

Viewed 4892

I'm actually totally stuck trying to add build a multilangual website. Since it's the first time, i'm following the tutorial from medium website which look pretty clear (https://medium.com/swlh/step-by-step-tutorial-to-build-multi-cultural-asp-net-core-web-app-3fac9a960c43), sorry for the link but it's only in case someone would need to read it.

In this tutorial, I need to add services.AddRazorPages() in the Configuration method of Startup.cs. It looks like something really easy to do but it throws an error which is "'IServiceCollection' does not contain a definition for 'AddRazorPages'".

I've tried to look for a solution on google but it seems that i'm the first one to have this error (couldn't find any related article).

Is there something i'm missing here with the .AddRazorPages()?

I'm using .NET Core 2.1

2 Answers

Have you placed services.AddRazorPages() in the ConfigureServices or in the Configure method? Because it should be in the ConfigureServices method.

Related