Thursday, November 7, 2013

Renaming Project Solution and Items

You may also like to see:
Visual Studio : Difference in Clean, Build and Rebuild solutions

Today I need to rename one of my Project Solution.It is actually complex to do correctly because the project name is used in several places.

Here are the steps you need to follow to rename a solution:

Step 1:

In Solution Explorer, right-click the project, select Rename, and enter a new name.

Step 2:

In Solution Explorer, right-click the project and select Properties. On the Application tab, change the "Assembly name" and "Default namespace".

Step 3:

In the main CS file (or any other code files), rename the namespace declaration to use the new name. For this right-click the namespace and select Refactor > Rename enter a new name. For example:

namespace WindowsFormsApplication1



Step 4:

Change the AssemblyTitle and AssemblyProduct in Properties/AssemblyInfo.cs.

[assembly: AssemblyTitle("New Name Here")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("New Name Here")]
[assembly: AssemblyCopyright("Copyright ©  2013")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

Step 5:

Delete bin and obj directories physically.

Step 6:

Rename the project physical folder directory.

Step 7:

Open the SLN file (within notepad or any editor) and change the path to the project.

Step 8:

Cleans and Rebuild the project

Here it is now your project is completely renamed.

If you found any other step I missed. Please comment here.

You may also like to see:
Visual Studio : Difference in Clean, Build and Rebuild solutions

10 comments:

  1. Thanks for the tips. They helped :-)

    ReplyDelete
  2. Sorry. maybe I'm just stupid but what is the main CS file?

    ReplyDelete
    Replies
    1. Open any .CS file and rename namespace as describe in steps.

      Delete
  3. What if the project is under TFS? Would the mentioned steps change the TFS side information too? Thanks.

    ReplyDelete
  4. for vb.net should i skip step 3 and 4

    ReplyDelete
  5. how about the edmx files??

    ReplyDelete

Life insurance policy, bank loans, software, microsoft, facebook,mortgage,policy,