Click here to Skip to main content
15,902,893 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Severity Code Description Project File Line Suppression State
Error CS0051 Inconsistent accessibility: parameter type 'UserManager<ApplicationUser>' is less accessible than method 'HomeController.HomeController(UserManager<ApplicationUser>)'

and this is my code:
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using LoginDemo.Models;
using Microsoft.AspNetCore.Identity;

namespace LoginDemo.Controllers
    public class HomeController : Controller

        private readonly UserManager<ApplicationUser> userManager;

        public HomeController(UserManager<ApplicationUser> userManager)
            this.userManager = userManager;


        public IActionResult Index()
            return View();

        public IActionResult Privacy()
            return View();

        [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
        public IActionResult Error()
            return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });

What I have tried:

i have check every thing in the project and i couldn't see anything but this?

please what can i do...?
Updated 29-Oct-19 13:20pm

Try removing readonly from your UserManager definition.
Share this answer
RickZeeland 24-Oct-19 14:37pm    
5d :)
Richard Deeming 25-Oct-19 12:15pm    
How would that make any difference to the inconsistent accessibility?
#realJSOP 25-Oct-19 13:11pm    
Dunno. Jst something I would try if it were me. Not seeing the rest of his associated code, the best he can expect is a WAG.
The error means that your HomeController class is public, but your ApplicationUser class is internal.

Compiler Error CS0051 | Microsoft Docs[^]

Make your ApplicatoinUser class public.
Share this answer
good night, not that does not work the error persist, i will began from the begining one more time and i will reinstall vs2017 to see if this work. thanks a million. i appreciate your time and patient and that really wish to help me, if what i sayd work i will tell you.

Share this answer
Dave Kreskowiak 29-Oct-19 21:15pm    
Reinstalling Visual Studio is not going to change anything. Your code has a problem, not Visual Studio.

Get rid of the readonly on the UserManager line. Also, your UserManager and ApplicationUser classes would have to be defined as public.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900