Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

services.AddRazorPages() : IServiceCollection does not contain definition

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

like image 973
Korpin Avatar asked Jan 21 '26 05:01

Korpin


1 Answers

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

like image 81
bertilvandekerkhove Avatar answered Jan 23 '26 07:01

bertilvandekerkhove