views:

98

answers:

2

I believe I understand fully the differences between Visual Studio 2005's web site model versus the web application project model that was fully delivered in VS2005 SP1 - but I have run into a confusing thing:

I have a web application project I wrote (it has a bin folder with the compiled projectname.dll and referenced .dlls too, etc.). but I just noticed that if I right-click on the project within Solution Explorer, a menu item called "Convert to Web Application" is exposed). That makes no sense to me.

I was comparing this project to a "web site" solution in VS2005 and contemplating converting it to a web application project. Strangely, the solution explorer offers nothing related to "Conversion to Web App" here like one would think is possible and/or appropriate.

I conclude there is nothing to help automate changing a "web site" construct to a proper "web application project". I assume it all has to be done by hand. Tasks such as reconstituting files in App_Code into one or more class library projects needs to be done manually.

I realize a lot has been written about the history and differences but can someone explain why the offer to "convert to web app" seems to be made in the "wrong" model - and just confirm that conversion is manual.

+2  A: 

The conversion wizard does a decent job -ie, the process is far from being strictly manual - but you're still going to spend a lot of time moving from the website to web application model.

The "Convert to Web Application" context menu option for aspx pages generates a myclass.designer.cs file, which ties controls defined in markup back to the codebehind class, allowing for intellisense, compile-time validation, and other things.

Performing this action on a project file should generate designer files for all of the aspx's in the project, and I believe also creates some default application settings such as assembly name, etc, that aren't defined in a website project where the output is source, not an assembly.

David Lively
After reading Scott Guthrie's tutorial and your answer too I think I see better why an existing web app would provide this "Convert to web app". As to why the web site model doesn't have it, I am guessing that when that model was put into the original VS2005 product they had no idea that they had neglected the project file model and hence the quick delivery of the "preview" and the SP1. I suspect the "conversion wizard" you refer to is for VS2003 web app to VS2005 web app. I am not aware of any conversion wizard that operates on VS2005 web site model. Where could I find that?
John Galt
+1  A: 

I'm going to guess that the 'web application' that you wrote didn't start out with the correct vsproj file. If you bring in a project that doesn't have the correct file system scheme .aspx, aspx.cs, aspx.designer.cs then visual studio will assume that you're trying to create a 'web application' and gives you that conversion feature.

Back in 2005, Scott Guthrie did a tutuorial about converting a web site project to a web application project. Here is the section about Migrating from a Web Site Project to a Web Application Project.

Hope this helps some.

Chris
Thanks Chris. I just studied Scott's tutorial which is very good and helpful. I am 99% sure I began this with a proper .vsproj file. I only have one default.aspx file within and it already had default.aspx.designer.cs nested near it. Perhaps the "Convert to web app" menu item is ALWAYS available (despite not being needed at present). The only other explanation might be the fact I have 2 HTTPHandler.ashx files (each with a .ashx.cs companion but neither has an .ashx.designer.cs). That's a guess because I suspect there is no such thing.
John Galt