To copy a project in C# (C sharp)

Revisiting C# (sharp), the land of abundance


Recently I need to make Windows forms application software for a small business.

Tested my old friend, Delphi 2007, the IDE used in my old employer, I found it expired or invalid for some reasons. Asked the old employer to reinstate my gear, but no action! Hmm ~

Microsoft C# (C sharp) happens to be up in my thought. Gratefully and reportedly it is free of charge since years ago. Downloaded and installed, it took me a day to finish everything to upgrade my development environment from Windows XP to Windows 7 .

With good memories of C sharp in early stages, I was excited to confirm this free version of C# 2010 express so robust and versatile in programming duties.

Followed up the installation of application into Windows 8 platform successfully, I am likely to expand the use of C sharp for the future PC programming tasks for a while.

Followings are the rundowns to reuse the projects in C# 2010 express (=IDE). Duplication of the form and code  in a development project  is highly recommended to save time, but somewhat cumbersome and error-prone. That’s why I make this note.


To copy and modify the Form1 in C sharp 2010 express


Step 1. [IDE] File / New Project

a. Set project name at Name field;
b. Save the target project and exit;

Step 2. [Windows Folder]

a. Copy the original project folder into the target project folder as a subordinate one;

Step 3. [IDE] Solution Explorer Window

a. Right-click the name of solution;
b. Click the “Add” and “Existing Project …”;
c. At “Add Existing Project Form”
…(1) Navigate to the project just copied (=the subordinate folder in step 2);
…(2) Open “.csproj” project file;
d. Confirm the newly copied project (with old stuff) created at the end of the solution component tree;

Step 4. [IDE] Solution Explorer Window

a. Double-click the Form1.cs of newly copied project to open;

Step 5. [IDE] File / Save As

a. Save the opened Form1.cs into the target project;
b. Confirm it if IDE asks the replacement of existing Form1 design file;
c. Confirm it if IDE asks the replacement of existing Form1 code file;
d. Check the check-box if IDE shows it for “Apply to All”;

Step 6. [IDE] Solution Explorer Window

a. R/click at the target project to see the options;
b. Select option “Set as Start Up Project”;
c. R/click at the copied project;
d. Select option “Remove”;

Step 7. [IDE] File / Save All

a. Save all and close the solution;

Step 8. [IDE] File / Open Project

a. Open the target project;

Step 9. [IDE] Solution Explorer Window

a. Double click the “Form1.cs” to open it;

Step 10. [IDE] File / View / Code

a. Wait the code file opened;
b. Find the namespace keyword and the old name given (at a line after the using directive group);
c. Change the old name to new one (typically same as your target project name);
d. If the rename option appears, then accept it;

Step 11. [IDE] File / Save All

a. Save all and close the solution;

Step 12. [Windows Folder]

a. Delete the copied old project folder under the target project folder;


Finally the Form1 design and codes are duplicated in this new target project. Without affecting the old project, now, we can expand it within the target project.

[Update for large project – 04/28/2014]

1. In case of large project,  all .CS files and. SDF dB files files would be required to be copied into the new project. For that, the object files may be copied at the old project and pasted into the new project within the solution explorer, instead of open/save in Steps 4-5 [IDE].

2. During .SDF duplication, the “Data Source Configuration” wizard shall come up. For the database model, “Dataset” would be given and “Tables” check-box should be marked for the database object.

3. If .RESX files are corrupted, then remove it from the new project and rebuild.

4. DataSet.XSD file should be automatically built if a .SDF DB file be copied.

5. If icon or pictures are involved, the “Resources” folder should be copied into the new project folder additionally. In IDE > Project > Resources menu, Icon file and picture files could be loaded respectively.

6. References may need to be added in IDE. For example,

       .NET > System.Windows.Forms.DataVisualization for Chart
COM > Microsoft Office 15.0 Object Library
.NET > Microsoft.Office.Interop.Excel for Excel embeded
.NET > System.Data.SqlServerCe for SQL Server Compact


Filed under News

5 Responses to To copy a project in C# (C sharp)

  1. I am really inspired along with your writing abilities as neatly as with
    the layout for your weblog. Is this a paid theme or did you modify it yourself?
    Either way stay up the excellent high quality writing, it’s rare to see a nice blog like this one these days..

  2. admin

    Hi toothbrush germs! Your praise breeds my progress ~

  3. Hi, thanks for sharing. I’m wondering if it’s OK to copy some of the text in my site?

  4. admin

    Sure Brian! My pleasure ~

  5. Simply want to say your article is as amazing. The clearness in your
    post is simply excellent and i can assume you are
    an expert on this subject. Well with your permission allow
    me to grab your feed to keep up to date with forthcoming post.
    Thanks a million and please continue the rewarding work.

Leave a Reply

Your email address will not be published. Required fields are marked *