Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 188
  • Last Modified:

How do I copy an existing project/solution and use it as the basis for a new piece of work

Hi,

I'm fairly/very new to Visual Studio.NET and am trying to pick up on a small project I did when learning ASP.NET abnd C# using VS.NET about 18 months ago. I'm re-reading all the books and notes that I've long since forgotten and have been having a hard time remembering just how the IDE works and re-learning how all the IIS related stuff links together.

Anyway, I'd like to take a copy of the work from 18 months ago and start off on a new piece of work using that as the basis  eventually I'd like to continue working on the original piece you see. I tried simply copying the folder from C:\Inetpub\wwwroot\OLD_WORK to C:\Inetpub\wwwroot\NEW_WORK and double-clicked the OLD_WORK.sln but many of the files were pointing to the original folder....I even tried renaming it to NEW_WORK.sln etc. but that didn't help either. And when I renamed OLD_WORK.csproj to NEW_WORK.csproj it said:

"The project you are trying to open is a web project. You need to open it by specifyin gits URL path."

....when I tried to open it. Clearly this didn't work!....I could almost hear the computer laughing at me.....

Can someone help me out here because I suspect that after I've got the code up and running properly in the IDE I can get back to my books and make proper progress...I just want it so that the new project has all the paths pointing to the correct folder, is renamed appropriately and is in all senses properly resolved.


Thanks in advance
Iain
0
iaing1000
Asked:
iaing1000
  • 5
  • 4
  • 3
1 Solution
 
surajgupthaCommented:
The general copy will work for windows applications but since you application OLD_WORK is a web application there should be a virtual directory associated with it.

My suggestion is for you to create a new website using the IDE. And then including all the files from your previous project using Add existing item.
0
 
hamidovtCommented:
- copy the C:\Inetpub\wwwroot\OLD_WORK to C:\Inetpub\wwwroot\NEW_WORK
- in new folder rename OLD_WORK.csproj, OLD_WORK.csproj.webinfo  and OLD_WORK.sln to NEW_WORK.csproj, NEW_WORK.csproj.webinfo and NEW_WORK.sln respectively
- Open NEW_WORK.csproj, NEW_WORK.csproj.webinfo and NEW_WORK.sln with notepad and replace all "OLD_" to "NEW_"
- Open IIS and select NEW_WORK directory under the root of your web
- Using right click + proterties go to the settining and on the Directory tab click "Create" (create application) button
0
 
iaing1000Author Commented:
Hi,

Please don't close this yet, I've been on another project so had to shelve it for a bit. Sorry for not keeping people updated.

I hope to be able to return to it later this week,

Thanks
Iain
0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
hamidovtCommented:
iaing1000:

Just try to follow the steps I have described
0
 
surajgupthaCommented:
Cleanup ? why?
0
 
iaing1000Author Commented:
Hi,

I've done the renaming of the 3 files, edited them to be the new name and created the web foldeer in IIS. The solution loads OK, builds OK with no errors or warnings, but when I try to run it, I get the following error from the VS IDE:

"A project with an output type of class library cannot be started directly.

In order to debug this project go to the debugging tab under configuration settings in project properties, and set the startaction to start external program or start url. Alternatively, you can add a non-library project to this solution that usess a reference to this project and set it as the startup project."

I suspect I'm very nearly there, since everything else is loading and biulding properly. Any idea how I overcome this problem?

Thanks
Iain
0
 
surajgupthaCommented:
When you created a new project you created a class library. You should create a new web site solution and then add/ rename all ur files.
0
 
iaing1000Author Commented:
Hi sarajguptha,

I'm not sure I follow? Can you please be very specific about exactly what I need to do?

When you say I should create a new web site solution and then add/rename all the files, haven't I already done this by following what hamidovt says?

Thanks
Iain
0
 
surajgupthaCommented:
The first solution you are talking a copy off. Is that a website or a class library??

Can you try openning the first project and see if it works fine before you proceed with the copy?

0
 
iaing1000Author Commented:
Hi,

The first solution is a website. The original works fine when opened in Visual Studio and run from there.

Thanks
Iain
0
 
hamidovtCommented:
As far as I understood you have done the steps I have described in my comment (i.e. renaming the files, manually editing them and creating a webfolder in IIS)

Considering that you receive the "A project with an output type of class library cannot be started directly….” error, I suspect two things.

- Do you have a startup page in you project, if not just create a web form and mark it as a startup page (right click in the solution explorer and “set as start page”).

- Second thing that could be a problem is configuration in IIS. Ensure that the webfolder is a web application (see directory tab in the properties). If it is just remove and create. There is a difference between virtual directory and  web application! If you have .Net 1.1 and .Net 2.0 installed you should have ASP.NET tab as well. Check if the version of NET your project is running is 1.1

Success!
0
 
iaing1000Author Commented:
Hi Hamidovt,

Yes, that was it. I needed to set a startup project, and then also a startup page.

After that it complained because various paths were pointing to the wrong place, so I just replaced every instance of OLD_ with NEW_ in the entire set of files under the new folder. This created two new problems that were easily fixed

a) The .SNK key didn't exist (because it was now looking for NEW_.SNK instead of OLD_.SNK, so I copied the old one from the original project and just renamed it in the same location

b) The .CSS file was still called OLD_.CSS so I renamed that too.

Now it's running fine ... well it isn't really, but that's because other things need fixing!

Thanks loads
Iain
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 5
  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now