Click here to Skip to main content
15,868,292 members
Articles / Web Development / ASP.NET
Article

How to copy and configure ASP.NET projects between different local computers

Rate me:
Please Sign up or sign in to vote.
3.64/5 (21 votes)
13 Mar 20054 min read 148.1K   48   31
This article describes how to copy project files from one disk source containing an invalid URL path, and set it up to allow VS.NET to accept the project by configuring a proper mapping.

Introduction

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:


Image 1

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.

  1. Go to the project you want to copy, such as one saved on an A: floppy drive.
  2. Find the vbproj.webinfo folder (or csproj.webinfo for C#) and double-click this file. It should look something like this:

<VisualStudioUNCWeb>

<Web URLPath = "http://localhost/ControlsList/WebForms/ControlsList.vbproj" />

</VisualStudioUNCWeb>

  1. 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.
  2. 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:

<VisualStudioUNCWeb>

<Web URLPath = "http://localhost/ControlsList/ControlsList.vbproj" />

</VisualStudioUNCWeb>

  1. Save this file and close it.
  2. 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
  3. Go to the Internet Information Services console. In Windows XP, choose ‘Control Panel-> Performance and Maintenance-> Administrative Tools and double-click Information Internet Services.
  4. Expand the (local computer) plus sign and expand the Default Web Site section (show in the diagram):

    Image 2

  5. 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: Image 3 <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"><o:lock aspectratio="t" v:ext="edit">
  6. Right click on the folder and select ‘Properties” as shown here.

    Image 4

  7. Under the application settings, click the “Create” button for the “Application name:” property.

    Image 5

    Notice that you will see the folder name appear in the text box and the button text changes from "Create" to “Remove" (shown here):

    Image 6

  8. Click on Apply and click OK.
  9. Notice in the Internet Information Services panel how the folder icon changes from a folder icon to an application icon as shown here: Image 7
  10. Lastly go to Visual Studio .NET and BUILD your project.
  11. 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:

    1. You did not successfully convert the project folder into an application. To correct this, follow the above steps 7 through 15 again.
    2. 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.

Parser Error

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'.

Source Error:

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

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Software Developer (Senior) PNC Bank
United States United States
Harry is a .NET Developer for a major financial institution building web and stand alone applications and class libraries. He also has experience teaching courses on ASP.NET and Microsoft databases. He holds a Master's degree in Information Science.

Comments and Discussions

 
GeneralCan't display the application in web browser Pin
Lian_H19-Jun-08 5:25
Lian_H19-Jun-08 5:25 
GeneralRe: Can't display the application in web browser Pin
harryteck19-Jun-08 15:34
harryteck19-Jun-08 15:34 
GeneralCommand line for COPY PROJECT in VS.NET 2003 Pin
lochan_indiana6-Sep-07 8:53
lochan_indiana6-Sep-07 8:53 
QuestionCannot run the project after copy to new system? Pin
mrajanikrishna25-May-06 16:11
mrajanikrishna25-May-06 16:11 
AnswerRe: Cannot run the project after copy to new system? Pin
harryteck26-May-06 3:23
harryteck26-May-06 3:23 
GeneralRe: Cannot run the project after copy to new system? Pin
mrajanikrishna26-May-06 14:55
mrajanikrishna26-May-06 14:55 
GeneralRe: Cannot run the project after copy to new system? Pin
harryteck27-May-06 17:13
harryteck27-May-06 17:13 
QuestionRe: Cannot run the project after copy to new system? Pin
mrajanikrishna28-May-06 15:06
mrajanikrishna28-May-06 15:06 
QuestionHow to open the web app on the internet Pin
HF Solutions3-Mar-06 12:46
HF Solutions3-Mar-06 12:46 
AnswerRe: How to open the web app on the internet Pin
harryteck5-Mar-06 14:22
harryteck5-Mar-06 14:22 
QuestionWorking in a Different Pool Pin
Centinell26-Feb-06 3:12
Centinell26-Feb-06 3:12 
AnswerRe: Working in a Different Pool Pin
harryteck26-Feb-06 8:54
harryteck26-Feb-06 8:54 
GeneralThanks for saving me time!! Pin
jumpstart791-Feb-06 22:21
jumpstart791-Feb-06 22:21 
GeneralRe: Thanks for saving me time!! Pin
harryteck2-Feb-06 17:23
harryteck2-Feb-06 17:23 
QuestionContinuation to an earlier Query :Error in writing to the Event Log Pin
Aanchal Naidu16-Dec-05 12:55
Aanchal Naidu16-Dec-05 12:55 
GeneralThanks Harry and one more Query Pin
Aanchal Naidu16-Dec-05 12:18
Aanchal Naidu16-Dec-05 12:18 
GeneralRe: Thanks Harry and one more Query Pin
harryteck17-Dec-05 4:40
harryteck17-Dec-05 4:40 
GeneralRe: Thanks Harry and one more Query Pin
harryteck17-Dec-05 4:47
harryteck17-Dec-05 4:47 
Aanchal,

I found this posted online recommendation, however, I did not try, nor take responsibility for any issues, due to the fact that it requires changes to your registries. So use at your own risk:

1. Give the ASPNET user permission to read the Security eventlog registry entry.

Run regedt32
Navigate to the following key:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\Security
Right click on this entry and select Permissions
Add the ASPNET user
Give it Read permission

2. Change settings in machine.config file

Run Explorer
Navigate to WINDOWS or WINNT folder
Open Microsoft.NET folder
Open Framework folder
Open v1.1.4322 folder (folder name may be different, depending on what dotnet version is installed)
Open CONFIG folder
Open machine.config file using notepad (make a backup of this file first)
Locate processmodel tag (approx. at line 441)
Locate userName="machine" (approx. at line 452)
Change it to userName="SYSTEM"
Save and close the file
Close Explorer

3. Restart IIS

Run IISReset (Start > Run , type IISReset and click OK)


-- modified at 10:47 Saturday 17th December, 2005
QuestionRe: Thanks Harry and one more Query Pin
Aanchal Naidu18-Dec-05 4:37
Aanchal Naidu18-Dec-05 4:37 
QuestionQuestions regarding:How to copy and configure ASP.NET projects between different local computers Pin
Aanchal Naidu16-Dec-05 5:11
Aanchal Naidu16-Dec-05 5:11 
AnswerRe: Questions regarding:How to copy and configure ASP.NET projects between different local computers Pin
harryteck16-Dec-05 6:24
harryteck16-Dec-05 6:24 
Generalcopy and configure ASP.NET projects between different local computers Pin
sidda23-Nov-05 12:22
sidda23-Nov-05 12:22 
GeneralRe: copy and configure ASP.NET projects between different local computers Pin
harryteck23-Nov-05 14:16
harryteck23-Nov-05 14:16 
QuestionHow to use my web application on another computer Pin
Nisarat30-Jun-05 18:43
Nisarat30-Jun-05 18:43 
AnswerRe: How to use my web application on another computer Pin
harryteck2-Jul-05 8:42
harryteck2-Jul-05 8:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.