Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.Net Core + The type or namespace 'SelectList' could not be found

I created a class in my model project that has several properties. Among them I have SelectList, but it is so weird I can't include it in my class. There is a red underline that says

The type or namespace "SelectList' could not be found

I've tried to include the namespace

using Microsoft.AspNetCore.Mvc.Rendering;

but there is a red underline in Mvc which says

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

What is the problem?

public class Student
{    
    public SelectList Region { get; set; }      
    public string FullName { get; set; }        
}
like image 391
bbusdriver Avatar asked Jan 23 '26 14:01

bbusdriver


1 Answers

Solved. I had to download microsoft.aspnetcore.mvc from Nuget Package Manager

like image 95
bbusdriver Avatar answered Jan 26 '26 16:01

bbusdriver