Cleanest way to start a WebAPI project in Visual Studio (NO VIEWS)

馋奶兔 提交于 2020-01-22 17:10:25

问题


What's the cleanest way to remove all extras that normally come with Visual Studio API Template, things like Views and other stuff that are not needed if you just want to have a WebAPI service??

I'm assuming that the folder VIEWS is for MVC Views ...maybe I'm wrong and it's all needed to have a running APIs.


回答1:


  1. Launch Visual Studio
  2. go to File -> New Project -> ASP.NET MVC 4 Web Application.
  3. Click OK
  4. then select "Empty" instead of "Web API"

That will not have any extras such as Views.




回答2:


  1. Launch Visual Studio
  2. Go To File -> New Project -> Web -> ASP.NET Web Application
  3. Enter name and press Ok
  4. Select Empty from Templates and then Select Web API from "Add folders and core references for: " section
  5. Press Ok
  6. You will get an empty web api project with all necessary dlls and web appi configuration added in the project.
  7. You will have to add your first controller by yourself though.



来源:https://stackoverflow.com/questions/19150879/cleanest-way-to-start-a-webapi-project-in-visual-studio-no-views

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!