bug: VS 2008 – Web Application Project opened as Web Site

Monday, November 3rd, 2008 | .NET

I just bumped into a weird Visual Studio (aka. Vicious Studio)  bug. Not the first, but this is a pretty annoying one. I have taken an old .NET 1.1 Web application and converted it to .NET 3.5 using the VS Conversion Wizard. Everything seems ok, and I convert to Web Site to a Web Application Project. No problems so far. I fix some issues, close the solution, do some other stuff. Some days later I open the solution again. I then have about 200 errors and the Web Application Project is opened as a Web Site. Also the designer and resx files are not connected to the asp and codebehind files:

It's not possible to change the project type in Visual Studio, as the project does not have a "properties" context menu item. The only option in the context menu is "property pages" as with regular web sites. Visual Studio actually thinks it's a Web Site and not a Web Application project anymore. The other missing context menu option is the "Convert to Web Application". So Visual Studio thinks it's a Web Site that cannot be converted to a Web Application Project. Not surprisingly as I converted the Web Site to a Web Application Project right after the Conversion Wizard.

Ok, I have to start digging into the project and solution files. Comparing them to other solutions using Web Application project files, I can't seem to find anything suspicious. After some googling with no result, I decide to stare at the screen for a while and use WinMerge to determine what the difference might be. Suddenly I find one minor difference:

The solution file that works:

Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Clock", "Clock.vbproj", "{3B3D0F02-D310-4BFB-83AD-F62758BB8624}"

The one that fails:

Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Calendar", "Calendar\", "{7B411329-B1CB-457F-A954-898DX16B85A6}"

That's it. The Calendar project reference is missing the whole path to the project file. When i change it to:

Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Calendar", "Calendar\Calendar.vbproj", "{7B411329-B1CB-457F-A954-898DX16B85A6}"

it opens as a Web Application Project, and now the resx and designer files are properly connected:

There might be other issues causing this behaviour, but at least this solved my problem. This is just the everyday life using Visual Studio. Actually I think it's a great IDE, but there are some strange behaviours now and then.
Update - In some occasions you might wan't to remove the .webinfo file. This file can be causing this behaviour.  Just remove it and instead set the startup path for your application in properties for the Web Application project.

Tags: ,

6 Comments to bug: VS 2008 – Web Application Project opened as Web Site

Tom G.
December 9, 2008

Thanks a lot!!. That was exactly what i was looking for. Changing the sln file and removing the .webinfo file solved everything.

Daskip
January 30, 2009

Legend… crazy wee bug, thanks for posting about it as while I could see the sln mess being created, the webinfo being the cause is a golden piece of information.

Nandini & Da
June 18, 2009

Thanks a lot…we only had to remove the webinfo file and did not change anything in the sln file. That worked…

Rakesh Nandrajog
June 19, 2009

Thanks a lot, removing webinfo file did the magic

Misbah Arefin
August 19, 2009

we recently converted a legacy application and had this same issue… removing the webinfo file did the thing

Gary
March 31, 2011

Thanks man – I spent over 7 hours trying to figure out what was wrong with my new laptop. I even uninstalled and reinstalled VS 2008. You saved me.

Leave a comment