Solution And Project Renaming - egnomerator/misc GitHub Wiki

Helpful Links


Renaming a Solution

  1. Right-click on the Solution root node and choose rename; enter the new name
    • if you have File Explorer open to the directory containing the .sln file, you will see the file name updated by this action
    • (alternatively, rename the .sln file in File Explorer)
  2. Sanity checks
    • May need to save all, close Visual Studio, an reopen the solution in VS if one of these below steps has issues
    • Rebuild Solution
    • Run all tests
    • Manual functional tests

Renaming Projects in a Solution

Renaming a solution project is a much more complicated process than renaming a solution.

If a solution has many projects, the below steps will need to be repeated for each project that needs its name updated.

Steps

  1. Right-click the project in Solution Explorer, select Rename, and enter the new name
  2. Right-click the project again and select Properties. Change the "Assembly name" and "Default namespace" on the Application tab.
  3. Right-click the project again and select Refactor -> Adjust Namespaces. Accept the changes.
    • if no Resharper:
      • manually update all the namespaces of this projects' classes
      • manually update all areas referencing these classes accordingly
  4. Change the AssemblyTitle and AssemblyProduct in Properties/AssemblyInfo.cs
  5. In File Explorer, delete the project's bin and obj directories
  6. In File Explorer rename the project's directory
  7. Save all, close Visual Studio, reopen the solution in VS
  8. Visual Studio won't be able to load the project (it will display as "unavailable"), so update the .sln file
    • Open the .sln file (with a text editor such as Notepad++) and change the path to the project (there may be multiple places)
    • This action may require opening the file with admin privileges
  9. Say Reload when Visual Studio prompts to reload projects due to updates
    • (this will occur when going back to VS after saving the .sln file updates)
  10. Sanity checks
    • During these sanity checks, the compiler may reveal some more issues to fix manually
      • This process is tough to nail down a tried and true, unvarying set of steps for
    • Rebuild Solution
    • Run all tests
    • Manual functional tests
⚠️ **GitHub.com Fallback** ⚠️