Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

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.

like image 823
SF Developer Avatar asked Oct 03 '13 04:10

SF Developer


People also ask

Are there views involved in Web API project?

Views are optional in an MVC project. They are only used for projects where there are HTML pages involved. You can use MVC to build web services and they don't require Views.

How do I create a Web API project in Visual Studio?

For this, open Visual Studio and click on File menu and click on New Project. This will open New Project popup as below. In the New Project popup, expand Visual C# and select Web node in the left pane. Select ASP.NET Web Application template in the middle pane and enter the name of a project and click OK.

How do I create a REST API project in Visual Studio?

Select the Visual C# | Web project type from the project type tree view, then select the ASP.NET MVC 4 Web Application project type. Set the project's Name to ContactManager and the Solution name to Begin, then click OK. In the ASP.NET MVC 4 project type dialog, select the Web API project type. Click OK.


2 Answers

  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.

like image 161
govin Avatar answered Sep 30 '22 19:09

govin


  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.

enter image description here

like image 31
Asad Ullah Avatar answered Sep 30 '22 20:09

Asad Ullah