Issue in Global.asax.cs page in MVC4

后端 未结 7 1530
轮回少年
轮回少年 2021-01-03 17:24

I my ASP.NET MVC 4 Project, my Global.asax.cs page shows the error on

 WebApiConfig.Register(GlobalConfiguration.Configuration);
7条回答
  •  孤城傲影
    2021-01-03 18:05

    In my case I was getting a similar issue in Glabal.asax:

    The name 'AreaRegistration' does not exist in the current context.
    

    I already had System.Web.Mvc namespace in Global.asax.cs but the compiler was somewhat not aware of it, that is, the AreaRegistration class was not being found.

    What fixed the issue was executing the following command in Package Manager Console inside Visual Studio:

    PM> Update-Package -reinstall
    

    After NuGet reinstalled all the project's packages, the missing class names appeared and the code built successfully.

    Something is broken in Visual Studio\NuGet restore pipeline...

提交回复
热议问题