Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Tuesday, December 12, 2006 5:30 PM
In Visual Studio programming C#
How do I create a new project that is similar to an existing project?
I want to keep BOTH the new project and the old project.
All replies (7)
Tuesday, December 12, 2006 5:35 PM ✅Answered
What do you mean by similar? Worst case you could simply duplicate the project files/directory in Windows, rename things as needed and add the copy to your existing project.
Tuesday, December 12, 2006 8:43 PM ✅Answered
you can add as many project files in 1 solution, even with multiple .NET languages combined, such as VB.NET and C#. Just right click on your solution in solution explorer and go to add > new project
Wednesday, December 13, 2006 6:13 PM ✅Answered | 13 votes
"rename as needed" is far more complicated than it sounds. Here is my solution:
You have an existing product for Dress Stores.
You just received an order from a Shoe Store.
There are differences between Dress Stores and Shoe Stores, but much of it is similar.
Rather than designing a whole new project, line by line,
you want to copy from the existing project, and just enter the differences.
For purposes of explanation, assume the Dress Store project is in the \DRESS folder and is called DRESS.
We will call the new project SHOES, located in the \SHOES folder.
(1)**Windows Explorer
Create new folder called \SHOES.
Copy just the files (not the folders) from \DRESS to \SHOES
Copy the Properties folder from \DRESS to \SHOES
Do NOT copy the bin and obj folders.
In the SHOES folder, rename DRESS.csproj to SHOES.csproj
delete DRESS.sln
(2)** Visual Studio
File > Open > Project/Solution
In \SHOES Open SHOES.csproj
On the top line, click Project > SHOES properties
If Application is not already chosen, choose it.
Change Assembly Name and Default Namespace to SHOES
click the Assembly Information button
Change the Title and Product to SHOES
Put mouse over the tab for this window and right-click. Click Save
Put mouse over the tab for this window and right-click. Click Close
(3) Edit Form1.cs (or whatever name you had given it).
Change namespace from DRESS to SHOES
There will be an underline under the last letter of SHOES
Put the mouse on this letter.
A dinky little icon will appear.
Choose Rename with preview
A window will appear showing you what Visual Studio will do.
Click Apply
This will automatically change the namespace every place it appears in this project.
(4) Make a change to the form, just to be able to verify to yourself
that you now have two different projects, DRESS (the old one), and SHOES (the new one),
and that you have not accidentally changed DRESS.
(5) Build > Build Solution
A "Save File As" window will appear for SHOES.sln
Click Save
Verify that the "Build succeeded"
Do Debug to verify that the project runs.
(6) ** Windows Explorer
Look in \SHOES\bin\Debug Verify that the .exe file is named SHOES.exe
Wednesday, January 14, 2009 3:44 PM
Thanks for the procedure. One follow up question: If you follow this procedure, what abou the GUID in assemblyinfo.cs? Doesn't that need to change to reflect the new project/solution?
Monday, March 12, 2012 5:07 PM
HI
Thanks a lot. I was in need of this process.It was very useful for me.
Tuesday, April 3, 2012 9:53 PM
My issue is similar to the origin of this thread, except for the following:
- my solution contains three projects
- the solution name is not an exact match for any of the projects
The existing solution backs up and restores the data for one of our products. Say the solution name is ABCBackupRestore and the project names are ABCBackup, ABCRestore and ABDbkrstInatall.
The new solution will perform the same functions for a different but similar product. The intended solution name is, say, XYZBackupRestore, with projects renamed similarly.
How should Saltzmeyer's instructions be modified to accommodate these differences?
Thanks,
Barry
My opinions are strictly my own. They do not reflect the positions of policies of AccessData Group LLC, or any other organized group. For that matter, they just barely reflect my OWN positions and policies!
Friday, January 17, 2014 1:54 PM
This is simple explained way to make a copy of original project (if you can create classes):
1. Close Microsoft Visual Studio
2. Open Microsoft Visual Studio and Create a new project (name it as you want)
3. Open Microsoft Visual Studio again and open original project (File->Open project->original project)
4. Make copy project similar as original one by creating classes and copying their contest - copy everything what is inside namespace paranthesis {}, because namespace names need to be different in original and copied projects.