4

I have an existing solution in VS2010. When I click the properties of my project I get the view as can be seen in image1.png: enter image description here When I create a new empty ASP.NET web application and click the properties of my project I get the view as can be seen in image2.png: enter image description here

A huge difference.

Now I'm implementing this code here: http://wcf.codeplex.com/wikipage?title=Getting%20started:%20Building%20a%20simple%20web%20api

And that tutorial assumes I get a view as I've shown you in image2.png

In image1 and image2 I've also marked the menu items: "Website" and "Project"

This makes me assume that I've created a website application whereas I need something different (I'm thinking a web application project).

Not sure what to do now, I need to convert my current application to another thing, but to which type and how to do it?

I also came accoss this post: http://blogs.msdn.com/b/webdevtools/archive/2009/10/29/converting-a-web-site-project-to-a-web-application-project.aspx But before I start screwing up everything :P Is that what would solve my problem?

Adam
  • 6,041
  • 36
  • 120
  • 208

3 Answers3

3

It should be possible to use either a web site or a web application project. In the example on the link you've posted, they use the predefined template for ASP.Net MVC Web Applications. This has several advantages - it sets up the structure and other resources for you - it's effectively a template.

For the purposes of the tutorial, why don't you just set up an application that way? If you've already written some code, you can just import it into the new application.

For future projects, you might want to consider which is best for your needs. Apart from structure, there are some other key differences between a web application and a web site project.

MSDN handily provides the differences here:

http://msdn.microsoft.com/en-us/library/dd547590.aspx

If you find you want the features of the web application, then the link you've posted is fine. You'll need to do some re-organizing of your references and so on and so forth, but the process is fairly straightforward (but not painless).

dash
  • 89,546
  • 4
  • 51
  • 71
  • PS - if the templates are not showing up in your instance of Visual Studio, then following the answer here should help: http://stackoverflow.com/questions/5496414/asp-net-mvc-3-project-templates-not-showing-up – dash Dec 02 '11 at 21:09
2

A "web site" in visual studio is the old, .net 1 style of creating web sites. It basically dynamically compiles the code in a folder when it's hit for the first time. Later .NET introduced a "web application" model where the code is compiled into a DLL and no code files are deployed with the site. "Web sites" are pretty much depcrated and shouldn't be used for any new projects unless you're doing a quick demo site. The codeplex project you referenced also depends on MVC 3 (which are web applications). You are probably better off just restarting like the tutorial says - create a new MVC application like it shows in its first screenshot.

If you do not have that option, use Web Platform Installer to add MVC for you - http://www.microsoft.com/web/downloads/platform.aspx

Good luck!

Morgan T.
  • 1,937
  • 1
  • 17
  • 20
  • Web Application model has been around from the start - the Web Site model was introduced in Visual Studio 2005 - its main benefit at the time was that you could deploy updates to pages individually - I never really got on with them :-) – dash Dec 02 '11 at 21:07
  • ah right - got my history mixed up. thanks. Yes they had some appeal but it's not worth it! – Morgan T. Dec 02 '11 at 21:17
1

I can't tell exactly what's going on from your screenshots, but if you have a web site that you need to convert to a web application project, you can find the directions here

Although the instructions are specific to VS2005, they are basically the same for 2010 as well.

AaronS
  • 7,649
  • 5
  • 30
  • 56