Tuesday, October 17, 2006

// // Leave a Comment

.Net 2.0 migration - continued

and we're off to do some migration.

Got my first look at VS2005 - nothing radically new. Of course, its been cutified a lot more - nice colorful icons and all that jazz you can expect from MS :-/

On the down side the "Web Site" model compiles slower than molasses going up a slope. No, seriously - its at least 15 times slower than what the solution used to compile under VS2003.

I'm getting ahead of my self here. To even get to the compilation stage i had to first run the Conversion wizard. The conversion tool spits out a nice little XML document logging the results which show up in our VS2005 screen once the conversion is completed.

Going through the conversion log, I didn't find anything unexpected - some files that were not included in the project were shown up as warnings.

Before you start compiling, I'd suggest you clear out all existing binaries from the bin folder of your projects.

Compiling the solution straight aways threw up the following errors (some of these were because i had "treat warnings as errors" turned on) -
  • ToString (IFormatProvider) is now obsolete - amazing how FxCop (MS tool) ALWAYS yelled at me for the exact opposite. I can't even count the number of substitutions i made less than a month to make FxCop complaining and now VS2005 complains. Bah!
  • ConfigurationSettings is obsolete and to be replaced by ConfigurationManager - simple search and replace operation.
  • The type 'xxx.yyy.zzz.Global' is ambiguous - got rid of this one by clearing out the binaries and compiling again.
  • Few other random obsolete functions classes to replace - nothing too complicated.
It took me about 4 hours to get the solution to compile, primarily because VS2005 was being obnoxiously slow at compilations. Researching the problem threw up some helpful posts from ScottGu - whu else ? here and here again Scott tries to help people optimize the compilation speed, mostly laying the blame on referencing external binaries ( and possible version conflict ). This explanation doesn't wash - I had none of those issues- barely 5-6 external references without any version conflicts and still the web site build made me shave twice - unacceptable. I really do want to know why is it slower than VS2003.

Moreover, to frustrate me even further, VS2005 in Web site model, throws out compilation errors in batches. So just when i would manage to get rid of 10, another 10 would show up on recompile - unbelievable. Its almost like they took away functionality with the web site model.

These guys will describe what a web site model is and what it is good for ( its all lies - the web site model is a abominable regression)

VS 2005 Web Project System: What is it and why did we do it?

Apparently some developers wanted it easier - no compilations, no fixed files in project, just copy and paste. So that means we all miss ASP ?

Anyways - after the conversion, I end up with my perfectly functional web applications ripped apart and all non-code behind files moved some well know directory called App_Code ( remember the ever annoying _vti_ directories- ha ha ). So now my code looked like this




I realized that this Web site model was not going to work (at least for us )for the following reasons

  • Only Buddha would have enough patience to compile the Web sites.
  • Deployment was going to a major pain. Assemblies are randomly generated to support the web site. I'm sure there is a work around - but why bother ?
  • In an enterprise environment, we want the strictness of explicit inclusion of files. The Web site model, it dawned upon me, is for - well, Web Sites- and not applications.
  • VS2003 structuring of Web Application was perfectly sensible and usable - why change it ?
I found caught myself fondly remembering the days of VS2003 - where Web projects were real projects (with actual files to support their existence) and not weak-kneed references to directory or this new-fangled ftp.

Funnily enough, MS released the Web application model for VS2005 sometime after the world screamed in anguish. Now its a part of VS2005 SP 1. Scott Gu's link takes care of all you need to know about Web Application projects in VS2005 and how to migrate from Web Site model to Web Application model.

And the Web application model looks like this

Then i go get the Visual studio update and follow steps . Now instead of App_Code - I have Old_App_Code. Although it all compiles pretty well. I had some issues with Code behind refernces and Web References which did not take too long to sort out.

The Web application project is much better - and guess what - not only does the solution now compile faster than web site, its faster than VS2003 as well!

Testing the code had me puzzled for a while. I knew i was doing everything right. My machine was set to using only the .Net 2.0 framework, thanks to the big red switch. Yet IIS seemed to be having trouble with the situation. Finally i figured out that you must go to the Asp Net tab in inetmgr and manually update it to use the 2.0 thread (don't worry - it'll be obvious once you get to the tab).

Everything worked after that. Well I had deployed and got working a solution with 30 projects with 5 of them being web projects in under 3 days. Not bad.

Special thanks to ScottGu, without whom many of us would still be struggling with migration. He has with relentlessly scoured the web to help out people with migration pains. Cheers Scott!

0 comments:

Post a Comment