Skip to content
June 9, 2013 / windperson

Make a cleaner ASP.Net Web API project in Visual Studio

If it is necessary to create an ASP.NET Web API site without the bundled help web page, follow these steps:

  1. Create new project using ASP.NET MVC 4 project template.
  2. Choose the “Empty” option on second page of ASP.NET MVC 4 project template.
  3. Remove Views folder and all files in it.
  4. Remove all other files in App_Start folder except WebApiConfig.cs.
  5. Remove all other method invocation except
    WebApiConfig.Register(GlobalConfiguration.Configuration);
    

    in Application_Start() method body of Global.asax.cs.

  6. remove those highlighted <add namespace="ooxx"/> tags in Web.config

    <system.web>
     <pages>
          <namespaces>
            <add namespace="System.Web.Helpers" />
            <add namespace="System.Web.Mvc" />
            <add namespace="System.Web.Mvc.Ajax" />
            <add namespace="System.Web.Mvc.Html" />
            <add namespace="System.Web.WebPages" />
            <add namespace="System.Web.Routing" />
          </namespaces>
      </pages>
     </system.web>
    
  7. Remove all nuget packages in project.
  8. Add “Microsoft ASP.NET Web API” nuget package:
    http://nuget.org/packages/Microsoft.AspNet.WebApi/
  9. Remove all using System.Web.MVC; expression in all source code files.
Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: