I wrote this article because I had many questions asked of me regarding the "simple" act of copying Visual Studio .NET projects from removable disk drives to a local machine. The issue is how the webinfo file was first created in the original project and what Visual Studio .NET looks for to map your project to the URL. The software is not "smart" enough to know that you saved your project on a floppy disk just so you could work on the project somewhere else on a different machine. So, when you try opening a project from a floppy drive, you get a type of error message that tells you the file path (from the A: drive) does not correspond to the URL that you set up with the original application, like with your localhost URL.
My example shows you how to copy VS.NET to accept your project by doing three general things, which are a) Change the vbproj.webinfo file to correspond to the path you want to work on in the destination computer, b) copy the project file to that destination path you specified and c) change the folder to an application in IIS.
Symptomatic type of error message:
Reason: The file path of the destination project does not map correctly to the project path specified in the webinfo file when trying to open it in Visual Studio .NET. For smaller projects with several files, it may be more convenient to just create a new project in VS.NET and add files to it from another project on a different disk location by using the Project menu in VS.NET. However, in larger projects that contain many files this option may be impractical. To get around adding all these files manually, follow these steps.
Steps to copy your project from one disk location to another computer with a different disk location or file path name and configure it appropriately to run.
- Go to the project you want to copy, such as one saved on an A: floppy drive.
- Find the vbproj.webinfo folder (or csproj.webinfo for C#) and double-click this file. It should look something like this:
<Web URLPath = "http://localhost/ControlsList/WebForms/ControlsList.vbproj" />
- This file is what is mapped between VS.NET and IIS from the original project. Note: localhost can also appear as the actual name of your local computer, whatever name you may have given it.
- Next, change the path name to the folder you want to copy your project to. For example, lets say we want to copy this project to just the ControlsList folder in the server root folder, so we would modify this as:
<Web URLPath = "http://localhost/ControlsList/ControlsList.vbproj" />
- Save this file and close it.
- Using Windows Explorer, copy your project folder from the source disk, (which will contain all the projects files from the A: drive in our example above) to the C:\Inetpub\wwwroot directory. Remember we changed the webinfo file to just have this folder in the server root. Now, it will have a physical file path of C:\Inetpub\wwwroot\ControlsList
- Go to the Internet Information Services console. In Windows XP, choose ‘Control Panel-> Performance and Maintenance-> Administrative Tools and double-click Information Internet Services.
- Expand the (local computer) plus sign and expand the Default Web Site section (show in the diagram):
- Go to the folder you copied from the A: drive to the wwwroot folder. For our example, the folder is named ‘ControlsList’. Notice how it is shown as a folder as like so: <?xml:namespace prefix = v /><v:shapetype id=_x0000_t75 stroked="f" filled="f" path="m@4@5l@4@11@9@11@9@5xe" o:preferrelative="t" o:spt="75" coordsize="21600,21600"><v:stroke joinstyle="miter"><v:formulas><v:f eqn="if lineDrawn pixelLineWidth 0"><v:f eqn="sum @0 1 0"><v:f eqn="sum 0 0 @1"><v:f eqn="prod @2 1 2"><v:f eqn="prod @3 21600 pixelWidth"><v:f eqn="prod @3 21600 pixelHeight"><v:f eqn="sum @0 0 1"><v:f eqn="prod @6 1 2"><v:f eqn="prod @7 21600 pixelWidth"><v:f eqn="sum @8 21600 0"><v:f eqn="prod @7 21600 pixelHeight"><v:f eqn="sum @10 21600 0"><v:path o:connecttype="rect" gradientshapeok="t" o:extrusionok="f"><?xml:namespace prefix = o /><o:lock aspectratio="t" v:ext="edit">
- Right click on the folder and select ‘Properties” as shown here.
- Under the application settings, click the “Create” button for the “Application name:” property.
Notice that you will see the folder name appear in the text box and the button text changes from "Create" to “Remove" (shown here):
- Click on Apply and click OK.
- Notice in the Internet Information Services panel how the folder icon changes from a folder icon to an application icon as shown here:
- Lastly go to Visual Studio .NET and BUILD your project.
- Run your project with the IDE or browser.
If you see a “Parse error message: Could not load type <packagefolder>.<WebformClass>” (shown below) when you run your project, then the issue may be because:
- You did not successfully convert the project folder into an application. To correct this, follow the above steps 7 through 15 again.
- You did not build your project. To do so in VS.NET, from the Build menu, either build or rebuild you project.
|Server Error in '/' Application. |
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
Parser Error Message: Could not load type 'ControlsList.WebForm1'.
|Line 1: <%@ Page Language="vb" AutoEventWireup="false" Codebehind="ControlsList.aspx.vb" Inherits="ControlsList.WebForm1"%>
Line 2: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
Line 3: <HTML>
Source File: c:\inetpub\wwwroot\ControlsList\ControlsList.aspx Line: 1
Version Information: Microsoft .NET Framework Version:1.1.4322.2032; ASP.NET Version:1.1.4322.2032