- Upgrade to VS2005 WebSite Project
- Upgrade to VS2005 Web Application Project
First of all you better be sure to install VS2005 Service Pack 1 from this link: http://www.microsoft.com/downloads/details.aspx?FamilyId=BB4A75AB-E2D4-4C96-B39D-37BAF6B5B1DC&displaylang=en . The service pack will install for you the VS2005 support for Web Application Projects (and fix an undetermined number of bugs).
A little history: Basically when VS2005 was released MS got rid of the Web Project model the way it was structured in VS2003. They introduced the Web Site, with a number of cute ASP.NET folders for Application Code, Resources, References, and other well structured nice crap. Nice as the Web Site project was, a whole lot of people started complaining that their VS2003 project were often being converted into wrecked conglomerates of pseudo-working code, and again the same people brought to attention that it would've been nice to migrate their apps without being forced to change the structure of the app (reasonable complaint we must admit). Said so MS released a VS2005 update to support the Web Application project, in order to make the life easier for those poor devils who were working on the previous version of Viz (what a nice thought).
So, what's the difference between a Web Site and a Web Application project? There's a lot out there on google you can find with a simple search if you want details, so I'll cut it short.
1) The WebSite Project has arguably better structure, with those cute ASP_NET folders (can help to keep the house tidy). The Web Site project doesn't include in your codebehind files the declaration of the server controls you put on the aspx file: they're created and placed at compile-time (so the build takes longer - if you care about this details).
2) The Web Application project keeps the same structure as the old VS2003 Web Project so you can keep working as you always did, BUT if you convert the codebehind format right clicking the solution/project or single code file and the selecting "Convert to Web Application" your classes will be split (and made partial) between the usual vb/cs code file and a designer code file, the latter generated to contain all the controls declarations. You can choose not to convert the format and keep totally working as you were BUT (again) when you add controls to the aspx in design view you'll often have to manually add the controls declarations into the vb file (definitely something you can live with).
Said so, I was dealing with a medium-size web app, with a bunch of user controls. I thought the WebSite was a nice option so I gave it a shot (following these steps - http://msdn2.microsoft.com/en-us/library/ms247241(VS.80).aspx); the overall result wasn't so bad, but when it comes to user controls - believe me - you don't wanna mess with a migration to Web Site project. As said above, this kind of project gets rid of your controls declaration so you lose any control above them, and a lot of stuff gets renamed generating unbelievable messes. For instance, one of the user controls I had on the page started throwing a Null Reference Error for no reason, and I had to dinamycally create it every page load (which totally sucks). You can get it working with a few hacks, but what you have is a wrecked ship (if you can live with that... well you'll soon get the .NET Butchering Certification, no doubt about it - just ask for it and send a sample of your work, we'll post about you and your lameness).
After this unbelievable and adrenalinic experience (I stayed late @work trying to hack the thing till the point it worked but they locked me in the building and I had to stay there till 22.30 pm on a Friday - fuck me!), I gave a shot to the Web Application (following this steps - http://webproject.scottgu.com/CSharp/Migration/Migration.aspx) and everything worked smoothly untill I tried to "Convert to Web Application", when it started bitching about something being under source control (which was obviously not the case as I disconnected and unbinded the project from source safe and brutally DELETED all source safe hooks). ScottGu might rock, but he can nothing against Visual Source Safe (look at this previous post to get a clue of why it sucks so much if you really are that curious - http://dotnetbutchering.blogspot.com/2007/11/aspnet-how-to-setup-web-application.html).=
In the end I sit with the Web Application Project WITHOUT "Converting to Web Application" (it sounds ridiculous but what are you gonna do) the file format, because of the Source Safe issue. It looked like a fair deal, and - experience (mine and of others) teaches - once you get it working in the 2.0 framework it's much easier to convert to a Web Site project (if you're one of those who must have everything), but - HEY - that's another post.
4 comments:
There is one way - and one way - to do a really good job of converting: dont. Bite the bullet and re-create the site in your project of choice. And dont say "we cant afford to". You can, you're just deciding to make maintenance a lot more expensive. Ive had to support a couple, I know.
Agreed. That'd be my first choice too. Anyways, converting from 2003 to 2005 Web Application without introducing the designer files, you're really just running the same code under the new framework. I've seen it happening a number of times and I think the risk is quite limited, you get a few crashes and whatnot depending on the project - but imho it's worth giving it a shot.
Hi there!
I have to make some modifications to an existing asp.net project (not developed by me). This prject did not have a .aspx.cs file, and later on realized that it s a Codebehind model. I dont have any information on where the .aspx.cs of the project is. I have the dlls and the other related files in Temporary ASP.net files in place. Is there any way i can find outthe location of .aspx.cs file or retrieve it in some way.
Awaiting your reply.
Thanks.
Kummi
Nice migration tips for vs2003 to vs2005.
Post a Comment