[Most of the info here is deprecated and no longer applicable to Visual Studio 2005]
The developers at Microsoft can’t program their way out of a paper bag. For whatever lame reason, they have never offered a way to fork a project in Visual Studio.
The following was copied from another blog’s comment section. Giving credit the comment was written by “flapdash”. I have reformatted and corrected some minor errors.
Here’s how I went about duplicating a C# solution…to make it easier, let’s call solution #1 “silver” and solution #2 “gold”:
- Windows Explorer: copy and paste “silver”…you will get “Copy of silver”. Rename this new folder “gold”.
- Inside the “gold” folder, open the silver.sln.
- Inside Visual Studio…in the Solution Explorer, right-click the Solution Properties and choose “Rename”. Rename it “gold”. Save the solution (it will be saved as “gold.sln”).
- Inside Visual Studio…in the Solution Explorer, right-click the Project Properties and choose “Rename”. Rename it “gold”. Do this for all of your projects inside the solution.
- Under each project, you will typically have items like “Properties”, “References”, “Forms”, etc. For easier discussion, let’s talk about “Resources.resx”. At this point, you will notice that, if you click on /Properties/Resources.resx in the Solution Explorer, the “Full Path” property will show “…\gold\silver\Properties\Resources.resx” … it still has the old “silver” in the path name. This is because we just copied-and-pasted without VStudio knowing about it, back in Step (1). What a pain it would be to update the “Full Path” property for each and every item! Now, here’s my trick to make things a little easier…
- Close VStudio (you should have saved “gold.sln” from Step (3) above, so VStudio should just close with no prompts.
- Open …/gold/gold.sln using a **text editor**. Now, just change the folder names inside gold.sln to match your new copied solution. For example, inside gold.sln, you should see a “Project” section…change the paths in this section. For this example, it would look something like this:
Project … = “gold”, “silver\gold.csproj”
(it still has the old reference to “silver)…now change the above to something like:
Project … = “gold”, “gold\gold.csproj”
Now, save gold.sln.
- In Windows Explorer, now rename the “gold/silver” folder to “gold/gold”.
- Now when you open gold.sln, the “Full Path” properties for the items are all updated properly to “…/gold/gold/…”. For example, Resources.resx Full Path is now “…\gold\gold\Properties\Resources.resx”. So, VStudio did the monotonous work for us.
Anyway, it is a pain in the rear that there is no super-simple way to duplicate and “fork” solutions like this…but the above was the simplest I could come up with.