Convert VB.Net Web Site to Web Application Project

 I am working with Visual Studio Pro SP1 and had some problems converting an old VB.Net web site into a VB.Net Web Application Project.  I followed the advice offered here ( ), but ran into a few kinks when using the process on a VB project. 

The Problem:
After creating a new Web Application Project, copying in the old files, and running the "Convert to Web Application Project" process, the site would no longer build.  Any classes stored in the "Old_App_Code" folder (previously named "App_Code" before conversion) could not be seen.  The original website was written using the root namespace, and when I converted it, VS changed the default namespace to the name of the project.

My Solution:
First, I changed the default namespace back to the root namespace (set Default Namespace to "" in project properties).  Next, and this is the part that confuses me, is that I copied the code from each file in the "Old_App_Code" folder, and pasted it into another newly created *.vb file in the same folder.  After I had done this for each file, I deleted the old *.vb files and renamed the new ones with the old names.  Viola!  Everything builds and works just fine.

I converted this project in order to prepare it for integration with MSBuild and Team Foundation server (MSBuild applications need a project file, hence the need to convert), and since most of our existing apps are VB.Net 1.1 or 2.0 Web Sites. (not Web Applications), I'm sure that I will run into this again.

Does anybody have an explanation of why the code-copying is necessary, so I can better explain the process to developers as they come on-board for our Visual Studio Team Suite rollout?



11/6/2007 4:34:25 PM
📃 1016 articles.

💬 6 Replies

I ran the conversion tool also as described on the scottgu site you referenced.  It's good, but does miss a few things, some of which I still have not resolved.

The conversion tool copies the files in "AppCode" to "OldAppCode" and marks their "build action" as "content" I believe.  So by creating a new cs or vb file, you basically set the build action to "compile" as it is by default for new code files.

I had started setting namespaces on our files.  After seeing your comments, I might start all over again and use your advice for namespaces.

11/15/2007 10:25:17 PM

Instead select all the files in the folder and right click > goto Properties > set Build Action to COMPILE.

 And the job is done instead of converting one file at a time. Saved me a lot of time.

11/23/2007 11:48:12 AM

Take a look at Microsoft's documentation on doing this conversion; mabye there is something that can help:


Thank you,

12/20/2007 7:12:04 PM

Changing the build action to "compile" worked... no need to copy the code into new files.  When I was selecting New Item->Class for the new "copy to" file, the default build action is set to "compile" by default for the new classfile.  Somehow the conversion process was changing the build action for the converted files (old files) to the "content" setting, which was causing zillions of errors.  Thanks for the help.



12/20/2007 7:27:11 PM


I am trying to convert an old ASP.Net 1.1 app to 2.0.

These are the steps I followed:

1) Open the 1.1 sln file with VS 2005 - it went through a conversion wizard process and converted the project succesfully.

2) Right click on root folder and select Convert to Web Application - It converted all the files to Partial Class model and created designer files as well.

3) Now I build the web site and it works fine - all the pages come up correctly. The fun starts now.....

1) I add a control to the aspx page and it does not get added to the designer page automatically.

2) I see lots of code highlighted in code behind page with error messages: (example: Control1 is not a member of webform1) there are hundreds of examples like that...though I can see control1 included in the designer class as well) and the page also works and compiles fine. As soon as I make some deliberate compolation error in my code behind file, VS now shows up all these messages as errors in the Error List.

I am confused as to what I am missing.

 Any pointers? 


6/6/2008 6:58:30 PM


I reccomend starting a brand new post on your issue in the ASP.NET forum so it gets a little more exposure, than this older post.  People may not read to the last post here to understand your problem.



Thank you,

6/6/2008 8:30:03 PM