[英]"Visual Studio has added the full set of dependencies for ASP.NET MVC 5 to project" Can I reverse it?
By mistake I create a MVC 5 Controler instead Web Api 2 Controller in my .NET Web API Project and I received the following message:我错误地在我的 .NET Web API 项目中创建了一个 MVC 5 控制器而不是 Web Api 2 控制器,我收到了以下消息:
Visual Studio has added the full set of dependencies for ASP.NET MVC 5 to project 'PROJECT_NAME'. Visual Studio 已将 ASP.NET MVC 5 的全套依赖项添加到项目“PROJECT_NAME”。
The Global.asax.cs file in the project may require additional changes to enable ASP.NET MVC.项目中的 Global.asax.cs 文件可能需要额外的更改才能启用 ASP.NET MVC。
Add the following namespace references:添加以下命名空间引用:
using System.Web.Mvc;使用 System.Web.Mvc; using System.Web.Routing;使用 System.Web.Routing; using System.Web.Optimization;使用 System.Web.Optimization;
If the code does not already define an Application_Start method, add the following method:如果代码尚未定义 Application_Start 方法,请添加以下方法:
protected void Application_Start() { } protected void Application_Start() { }
Add the following lines to the end of the Application_Start method:将以下行添加到 Application_Start 方法的末尾:
AreaRegistration.RegisterAllAreas(); AreaRegistration.RegisterAllAreas(); RouteConfig.RegisterRoutes(RouteTable.Routes); RouteConfig.RegisterRoutes(RouteTable.Routes); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); BundleConfig.RegisterBundles(BundleTable.Bundles); BundleConfig.RegisterBundles(BundleTable.Bundles);
Is there a simple way to reverse this?有没有简单的方法可以扭转这种情况? Do I have to delete unnecessary files and dependencies one by one manually?我是否必须手动一一删除不必要的文件和依赖项? Will previously created Api controllers work without changes?以前创建的 Api 控制器是否可以在不更改的情况下工作?
Any help or assistance would be greatly appreciated.任何帮助或协助将不胜感激。
If you're using any form of source control like Git or TFVC you can just undo the changes.如果您使用任何形式的源代码控制,如 Git 或 TFVC,您只需撤消更改即可。
Otherwise, unfortunately, yes to:否则,不幸的是,对:
Do I have to delete unnecessary files and dependencies one by one manually?"是不是要手动一一删除不必要的文件和依赖?”
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.