Как изменить название проекта 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.

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 ?

asked Aug 19, 2017 at 15:22

canmustu's user avatar

canmustucanmustu

2,1444 gold badges19 silver badges33 bronze badges

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.

d.i.joe's user avatar

d.i.joe

5767 silver badges22 bronze badges

answered Aug 19, 2017 at 15:55

Krzysztof Lach's user avatar

Krzysztof LachKrzysztof Lach

1,2301 gold badge12 silver badges19 bronze badges

4

To rename a solution

  1. In Visual Studio Solution Explorer, right-click the solution node
    and then select Rename from the context menu.
  2. Type the new name for your solution.

To rename a project

  1. In Visual Studio Solution Explorer, right-click the project node and
    then select Rename from the context menu.

  2. Type the new name for your solution.

To change default namespace : Go to Project-> Properties-> Default Namespace and enter the name you wish to have.

To change namespaces of old files please refer this stackoverflow post

Replace in Files (Ctrl+Shift+H) will replace old namespace with new one !

To update references : you need to add references again , i don’t think there is a simpler way. Besides deleting and adding references is pretty straightforward

Hope this helps !

answered Aug 19, 2017 at 15:29

Ankit's user avatar

AnkitAnkit

5,3732 gold badges22 silver badges23 bronze badges

6

In .net core 2.2 there is a file _ViewImports.cshtml through an exception when you try to rename a namespace, to overcome this rename the namespace in this file manually first (no need for refactor -> rename) and then rename thenamespace` from elsewhere using refactor -> rename.
Hope this help.

Ricardo Gonzalez's user avatar

answered Oct 11, 2019 at 14:30

Ahmed Khalid Kadhim's user avatar

I was able to change my entire solution today by doing the following (keep in mind I purposely wanted to change every name from the old to new (including string literals).

  • Notepad++ Find and Replace entire solution folder with the old and new name
  • Manually change folder names / project names

This will only work if you want to change absolutely everything from the old to new name but its a bit faster and less complicated.

answered Apr 21, 2022 at 15:14

ben rycroft's user avatar

2

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 ?

asked Aug 19, 2017 at 15:22

canmustu's user avatar

canmustucanmustu

2,1444 gold badges19 silver badges33 bronze badges

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.

d.i.joe's user avatar

d.i.joe

5767 silver badges22 bronze badges

answered Aug 19, 2017 at 15:55

Krzysztof Lach's user avatar

Krzysztof LachKrzysztof Lach

1,2301 gold badge12 silver badges19 bronze badges

4

To rename a solution

  1. In Visual Studio Solution Explorer, right-click the solution node
    and then select Rename from the context menu.
  2. Type the new name for your solution.

To rename a project

  1. In Visual Studio Solution Explorer, right-click the project node and
    then select Rename from the context menu.

  2. Type the new name for your solution.

To change default namespace : Go to Project-> Properties-> Default Namespace and enter the name you wish to have.

To change namespaces of old files please refer this stackoverflow post

Replace in Files (Ctrl+Shift+H) will replace old namespace with new one !

To update references : you need to add references again , i don’t think there is a simpler way. Besides deleting and adding references is pretty straightforward

Hope this helps !

answered Aug 19, 2017 at 15:29

Ankit's user avatar

AnkitAnkit

5,3732 gold badges22 silver badges23 bronze badges

6

In .net core 2.2 there is a file _ViewImports.cshtml through an exception when you try to rename a namespace, to overcome this rename the namespace in this file manually first (no need for refactor -> rename) and then rename thenamespace` from elsewhere using refactor -> rename.
Hope this help.

Ricardo Gonzalez's user avatar

answered Oct 11, 2019 at 14:30

Ahmed Khalid Kadhim's user avatar

I was able to change my entire solution today by doing the following (keep in mind I purposely wanted to change every name from the old to new (including string literals).

  • Notepad++ Find and Replace entire solution folder with the old and new name
  • Manually change folder names / project names

This will only work if you want to change absolutely everything from the old to new name but its a bit faster and less complicated.

answered Apr 21, 2022 at 15:14

ben rycroft's user avatar

2

Всем привет. Я пишу код в консольном приложении (.NET Framework). На C Sharp.
Вот мне приспичило поменять название проекта вместо ConsoleApp1.sln на свое. Че-то долго гуглил, какой то Вася Пупкин посоветовал зайти в папку с проектом и его переименовать, но потом в визуал студио ничего не поменялось, и в добавок он написал путь не найден, удалить проект?
Благо у меня была копия. Но я все же нигде не нашел как поменять название???


  • Вопрос задан

    более года назад

  • 8460 просмотров

Для переименования проекта:
1. Переименовываете сам проект в Обозревателе решений;
2. В свойствах проекта меняете везде старое название на новое.
3. Закрываете проект, переименовываете папку с ним;
4. Переименовываете MyProjectName.sln ;
5. Открываете блокнотом MyProjectName.sln , меняете название папки на новое.
Всё

Попробуйте или F2 по проекту, или в свойствах проекта.

Не уверен, фича это самой студии или решарпера, но можно просто через пкм по проекту (csproj) в обозревателе решения
А чтобы переименовать решение — надо переименовать сам файл (sln)

Пригласить эксперта


  • Показать ещё
    Загружается…

10 февр. 2023, в 17:14

20000 руб./за проект

10 февр. 2023, в 17:11

20000 руб./за проект

10 февр. 2023, в 16:57

1500 руб./за проект

Минуточку внимания

Понравилась статья? Поделить с друзьями:
  • Как изменить название программы android
  • Как изменить название приложения на хуавей
  • Как изменить название приложения на сяоми
  • Как изменить название приложения на редми 9
  • Как изменить название приложения на андроид хонор