Question

In other words lets say i have already completed a project using visual studio. Now i want to make a separate project that is identical to the already completed project(except for some future changes).

How can i do this while keeping the new project in the same workspace as the original without:

  • creating a new project and copy pasting code over
  • copy-pasting the folder that holds the project and changing the name of the folder

I'm asking because there must be a better way to do this than the two options above.

Was it helpful?

Solution 2

The second option is exactly what you should do: duplicate the folder containing your project and then rename it.

To make this work, you might also have to change the GUID used by the project to avoid clashes. Visual Studio is supposed to do this automatically if another project with the same GUID already exists in the solution. If something goes wrong, you can do it manually by editing the project file (it's the field called ProjectGUID). It's just a standard GUID value, so use any freely-available GUID generator like the one bundled with Visual Studio or one you find online.

Why should there be a better option than this? What would that "better" option look like? It's not like there's going to be a menu command for it, this isn't a very commonly used feature. Most programmers use a source control system that handles branching/duplicating for them automatically and [mostly] without pain.

OTHER TIPS

  1. Right click on the solution and "Open Folder in File Explorer"
  2. Copy the project folder
  3. Rename the new Project folder
  4. Open the new project folder and rename the .csproj file
  5. Right click on the solution and "Add" "Existing Project" to the solution
  6. Open the "Properties" for the new project
  7. Under "Application", change the assembly name and default namespace
  8. Select "Tools", "Create GUID", Option 6, "Copy"
  9. Under Assembly information, change the name and product
  10. Paste in the GUID and clear the "" suffix
  11. Rename the namespace in the source files to reflect the new namespace from above.

Depending on your needs, you could get by with a subset of these steps (e.g. steps 1 and 2), however, I think a complete copy requires all of the steps mentioned.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top