Tuesday, December 22, 2009

The Great Web Project Conversion

Our current Intranet is an intricate mess of 3 different versions of ASP. It consists of classic asp pages and it's also a .NET 1.1 web project along with some .NET 3.5 web projects thrown in using different versions of .NET code libraries. We have grand plans of converting everything to the newest version of .NET while making a brand new Intranet. However, we keep getting new project that keeps preventing the continuation of this scheme. I recently got fed up with the issue and carved myself enough time to attempt to convert at least the main Visual Studio 2003 web project to Visual Studio 2008 to eliminate at least one version of .NET. As with everything Microsoft related, this did not go without some adventures.

Step #1. I ask our server admin to create a website. Then I copy over the files that belong to this particular project along with just enough of the classic ASP pages so I can make sure I can log in and the website works. (The default landing page is in classic ASP.)

Step #2. I open the project in VS 2003 to make sure I can do it and that I can build the project. So far so good.

Step #3. I open up the VS 2003 project file using the Microsoft Visual Studio Version Selector. I get a warning that this will convert my project. Great! That's what I want. The project converts without a hiccup.

Step #4 is where the trouble begins. I try to open the project in VS 2008. It tells me that it "The local IIS URL http://convertedproject.com specified for Web project convertedproject.com has not been configured. In order to open this project the virtual directory needs to be configured. Would you like to create the virtual directory now?" It is set up as a website so what does it mean it is not configured as a virtual directory? If I click No, the project won't open. If I click yes it tells me "Creating a virtual directory is only supported on the local IIS server." Now what?

Step #5. I remember that VS 2008 differentiates between a web site and a web application. Maybe the conversion process converted this to a web site? I go to File>Open>Web Site. I navigate to the folder where the project/site is located. And it opens!

Step #6. I try to build the project. I can't compile because I get the following error: "Request for the permission of type 'System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed." A little searching tells me I have to adjust the code access security on my computer for .NET 2.0 project because I am trying to access the project from another server on our network. However, I do not see the Microsoft .NET Framework 2.0 Configuration under Administrative Tools on my computer.

Step #7. It turns out I have to install the .NET 2.0 SDK to adjust the code access security.

Step #8. Adjust the level of trust to Full Trust for Local Intranet. Here is how you do it: Administrative Tools > Microsoft .NET Framework 2.0 Configuration > Configure Code Access Security Policy > Adjust Zone Security > Make changes to this computer > Local Intranet > set to Full Trust.

Step #9. Attempt another compile. It still won't compile. It complains about a web.config file that is part of another project that is located in a subfolder of this converted master project. I can't exclude the folder from the project because I do not get that option on right click. Back to searching. I find that I can either make the folder hidden in the properties (which I tried but didn't work) or I can make that folder a virtual directory and then it will be automatically excluded. This folder is a virtual directory/application in the original application but not here yet. I made it into an application. Still Visual Studio keeps insisting on including that folder. In fact after a while I got this message on build: "Failed to start monitoring changes to because the network BIOS command limit has been reached." The solution for this seem to mean messing with the registry but fortunately I didn't have to go that route. Read on.

Step #10. After another round of search I find out that the virtual directory will be excluded only if I open the application via HTTP. So I close the project and go back to File > Open > Web Site. On this dialog box I see several different options on the left side. I choose Remote Site. I specify the site URL and this time I get this message: "The Web server does not appear to have FrontPage Server Extensions installed." Are you kidding? Our server admin did not like this at all and was hesitant to install it. One of our programmers was there during our conversation as well and he said it really should be a web application not a web site. I told him I tried to go that route but bumped into a wall. However, I'm willing to give it another try.

Step #11. This is basically the same as Step #4 which is trying to open up the vbproj file. Same message. While I'm pondering I was clicking around and I see that while the project did not load I still get the following option on the right click: Edit convertedproject.vbproj.

Step #12. I open up the vbproj file which is just a confusing looking xml file. I am scrolling through it to see if anything makes sense. I get towards the bottom where I see this node: UseIIS and its value is set to True. Hmm, what happens if I set to False? OMG, the project opened up???!!!

Step #13. I don't dare get my hopes up. I was able to open up the project previously but could not compile. What happens if I try now? It did not compile. :(

Step #14. I have to fix a few compile errors that are at least not as mysterious as the previous messages. All I have to do is convert a few things explicitly to string.


And with this last step my great conversion project is essentially complete. I still need to do a few tests to make sure everything works but it's done!

It took wading through only 6-7 error messages. Not bad for a day's work!

No comments:

Post a Comment