Visual Studio – Copy to create a new project

how to create new project by copying from another one

  • Copy and paste the project folder
  • Rename the folder(s) outside Visual Studio. (Rename in TFS if using source control)
  • Open the solution, ignoring the warnings (answer “no” if asked to load a project from source control).
  • Go through all the unavailable projects and…
    • Open the properties window for the project (highlight the project and press Alt-Enter or F4, or right-click > properties).
    • Set the property ‘File Path‘ to the new location.
      • If the property is not editable (as in VS2012), then open the .sln file directly in another editor such as notepad++ and update the paths there instead. (You may need to check-out the sln first in TFS etc.)
    • Reload the project – right-click > reload project.
    • Once reloaded, right click the solution name and click rename to the new project name
    • Right click the solution and go to Properties, change the Assembly name and Root namespace to the project name.

Note: Other suggested solutions that involve removing and then re-adding the project to the solution will break project references.

If you perform these steps then you might also consider renaming the following to match:

  1. Assembly
  2. Default/Root Namespace
  3. Namespace of existing files (use the refactor tools in Visual Studio or ReSharper’s inconsistent namespaces tool)

Also consider modifying the values of the following assembly attributes:

  1. AssemblyProductAttribute
  2. AssemblyDescriptionAttribute
  3. AssemblyTitleAttribute

Leave a Reply

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