Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change whole solution's project's name in Visual Studio?

I have ASP.NET CORE C# project.

I want to change my solution name and whole project's name.

For Example :

OldSolution.OldName // this is Solution

OldSolution.OldName.Project1
OldSolution.OldName.Project2
OldSolution.OldName.Project3

to

ChangedName.NewName // this is solution

ChangedName.NewName.Project1
ChangedName.NewName.Project2
ChangedName.NewName.Project3

with all namespace changing, name of projects which referenced to other projects ( when i look at references of a project, referenced projects are still same name. They have not been changed. )

can i do that ?

like image 934
canmustu Avatar asked Aug 19 '17 15:08

canmustu


People also ask

How to change the name of a Visual Studio project?

If you open again Visual Studio and open the solution by Browsing after the new name (File -> Open -> Project/Solution ..), you will see that the new name for the solution has been changed. Right-click the project again and select Properties.

How do I rename a Visual Studio solution file?

Open the solution file in Visual Studio; a warning message will appear as shown below, click “OK.” It means the Visual Studio is unable to load the project. Click on the project name and press the “F4” key to open project properties. Now rename the file path as shown below.

How to change ASP NET MVC solution name in Visual Studio?

In this article will learn how to change ASP.NET MVC solution and all the projects name in visual studio, let’s do it step by step. First of all, rename your solution and projects name. Then go to the project’s properties. Change Assembly name and Default namespace name with the new project name.

How do I change the solution properties in Visual Studio?

Solution properties To access properties on the solution, right click the solution node in Solution Explorer and choose Properties. In the dialog, you can set project configurations for Debug or Release builds, choose which projects should be the startup project when F5 is pressed, and set code analysis options.


1 Answers

I was also struggling with this problem and didn't find automated way to do this. I had to do it manually like that:

Renaming the Solution. Easiest part. Go to Solution Explorer (from menu View -> Solution Explorer), select the solution and then hit F4 (or from menu – View -> Properties Window), select the Name property and type the new name and then press ENTER. This will not change the name of the folder in which the entire solution exists. If you want to change that (and I did wanted to do that), you have to close Visual Studio and then rename that folder. If you open again Visual Studio and open the solution by Browsing after the new name (File -> Open -> Project/Solution ..), you will see that the new name for the solution has been changed.

This is how you can try to do it with projects:

  • Right-click the project in Solution Explorer, select Rename, and enter the new name

  • Right-click the project again and select Properties. Change the "Assembly name" and "Default namespace" on the Application tab.

  • When you have ReSharper installed, right-click the project again and select Refactor -> Adjust Namespaces. Accept the changes.

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

  • Delete bin and obj directories in Windows Explorer

  • Open the SLN file (with a text editor such as Notepad++) and change the path to the project (there should be multiple places).

  • Open the Solution again. Clean and Rebuild the project.

like image 92
Krzysztof Łach Avatar answered Sep 23 '22 14:09

Krzysztof Łach