Tuesday, September 8, 2009

Migrating from NET 2.0 to NET 3.5

In my last post, I mentioned that I successfully migrated my website from .NET 2.0 to .NET 3.5. Here I will describe how I did it.

Initial preparation:
1. You need to setup the .NET 3.5 environment on you local machine. So, download and install .NET Framework 3.5 and Visual Studio 2008 from Microsoft website. If you have VS 2005 with you, even that will work fine but VS 2008 would be better.

2. Also download the latest version of Ajax Control ToolKit from here. Note that for .NET 2.0 you installed Ajax extentions separately. In .NET 3.5 you don't have to do that. They are automatically included when using ASP.NET AJAX in ASP.NET 3.5 SP1. Only the Control ToolKit needs to be installed separately.

3. Now create a sample application by launching Visual Studio 2008. Apart from other files, the sample application will generate the web.config file, as usual. This file references all .NET 3.5 assemblies and other stuff and is core to your application as well as to the migration process.

4. Add reference to the Ajax Control ToolKit by dropping an Ajax control in the default page or by simply coping and pasting the AjaxControlToolKit dll file in the bin folder (you will have to create the folder as well).

5. Launch the application to see if it is running fine.

Testing on your Host Server
1. Before the actual migration, you need to be sure that your host server will support .NET 3.5. You can ask your host as well as run a test application.

2. Note that the migration will affect mainly your Bin folder and web.config file.

3. Choose a suitable time when you can put your website down. Log into your FTP account and delete the Bin folder and web.config file. Now upload the new Bin folder and the new web.config file, along with a new sample page that you created. Test this sample page on your website. It should work if the hosting server supports .NET 3.5. If it doesn't work, revert back to the older bin folder and the web.config website.

Finally getting it up:

Assuming that the sample page worked, you are now ready to fully migrate to .NET 3.5.

Mainly you are looking at updating the assembly files and the web.config. You need to take the new web.config file and compare it with the older web.config file. Whatever things are common (but have a version difference) just ignore them. Look for custom settings that you might have added to the web.config file such as database connection strings, URL rewriting rules, etc. Copy those addiitional lines of code and paste them in appropriate places in the new config files. Similarly compare the old Bin folder and the new Bin folder. What ever files are common (but may have version difference), don't touch them. Just look for any additional DLLs that your application might be using (any custom or additional DLLs). Copy those additional DLL files to the new Bin folder.

Just for being sure, also check your master page. Some programmers tend to make references to assembly files in master page. If so, you need to update the version based on the version specified in web.config file.

Replace the bin folder and the web.config file in your web application with the new ones. That's it. You are done.

Upload this and you are now running on .NET 3.5!

Happy migration!

No comments:

Post a Comment