Just yesterday I signed off one of my tasks as "Done" at work. Pretty mundane, signing off a task but this was to migrate two major e-commerce sites from the .Net Framework 1.1 to 3.5. And I must say, it wasn’t as much fun as I expected (or hoped it would be). But I learned loads of stuff!
I’ll do my best to word it as simply as I can and because two websites were migrated, I think this can serve as an example of how to mess it up the first time, and do it right the second time. 🙂
Before starting migration, I suggest that you prepare a few things and make sure of their state if you don’t want your life to end up in ruins.
First – should not need stating but I still will. Make sure that the website(web applications came with 2.0) you will migrate builds successfully. Migrating a site that has errors will be ugly and you will have to be a dreamer if you think it is possible. If you do try, however, even after reading this warning, I will hunt you down and slam your face on your keyboard.
Second – this is more of a suggestion than anything else. The site you want to migrate.. should ideally have followed best practices and coding guidelines. If you don’t know how to make a site that follows coding standards and best practices, tell me who your employer is and I’ll have you fired. 🙂
These two conditions, if fulfilled, will take loads of work off your shoulders and you will have more time solving that blasted rubik’s cube.
For the first site I migrated, these are the steps taken:
1. Create a copy of the entire site, to another server. Not only to have a backup but also to have a nice, clean place to work in. You will be doing the migration in the second server. Make sure that you have replicated the paths and files properly and exactly. Another thing you need to copy is the IIS settings. You can export the original IIS settings and create a new website in the new server’s IIS using the generated XML file.
2. If all goes well, test the new copy by opening it with VS2003 and performing a build. If it builds, then you can proceed to the next step.
3. Before performing the migration, change the new IIS settings, the ASP.Net version to be more precise, from 1.1.something, to 2.0.507.
4. You are now ready to migrate. Fire up VS 2008 (I used VSTeam System for this) and click File-Open-Project then navigate to the path of the project file. The .prj file and not the solution file.
5. You will then be prompted to migrate the site. Let the wizard do its work and let it finish. Depending on the size of the site, this can take as quick as a few seconds to as long as, well, I really don’t know. 🙂
6. After the wizard is done, right-click on the Solution (in solution explorer – if there is no solution visible, click tools-options and put a checkbox in the "always show solution file: thingie) and then choose Convert to Web Application and let Visual Studio do its job. Your files will double in size because VS will add designer files to each page. Also, you will notice that some of your code has been moved to the app_code folder, where they should be.
There are some other things that you should look out for:
1. Third party APIs or DLLs that are not compatible with Framework 3.5
2. Objects or custom controls that are not compliant with FW 3.5
I was just lucky that the project I migrated was well coded and did not have any code that was funky enough to give me trouble.
Next task is to perform a successful build using VS2008. If all went well, you will just be given warnings for deprecated HTML tags, old constructs like changing the CodeBehind attribute in the page directive to CodeFile.
At this point, I was blindsided by something I overlooked! In the process of copying the entire site, I copied the entire site (duh..) but including some folders that should have been left behind. These were the _vti folders used by frontpage extensions. Nothing much right? just delete the folders.. nothing is ever that easy. As it turned out, these folders also contained information about source control binding. And what is so bad about that? Nothing really… I WAS JUST UNABLE TO UNBIND IT from the original source control!
So, to solve this, I needed to open up the solution and project files with my favorite text editor and remove the source control bindings manually.
Solution? Replace the copy procedure. Don’t use windows explorer to copy the files. use whatever source control you use to create a copy of your original site. This should make things easier.
And that’s it!