如何从 Visual Studio 中重命名项目文件夹? [英] How can I rename a project folder from within Visual Studio?
本文介绍了如何从 Visual Studio 中重命名项目文件夹?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我目前重命名项目文件夹的解决方案是:
My current solution for renaming the project folder is:
- 从解决方案中删除项目.
- 在 Visual Studio 外重命名文件夹.
- 将项目重新添加到解决方案中.
有更好的方法吗?
推荐答案
这在 Visual Studio 2015 中很简单(可能适用于旧版本)
- 在解决方案资源管理器中,右键单击主要解决方案 →重命名
- 在解决方案资源管理器中,右键单击项目(在解决方案下)→重命名
- 在解决方案资源管理器中,双击或右键单击属性 →转到 Application Tab,重命名 Assembly name 和 Default namespace 以匹配.
- 如果您还想重命名命名空间,请打开您的类文件之一.右键单击命名空间 →重命名....这应该搜索并替换整个项目中对您的命名空间的所有引用.
- 关闭项目 →重命名项目文件夹.
- 在记事本中编辑
.sln
文件, 并更改 csproj 的路径,即fuar.csproj
→barar.csproj
.
- In Solution Explorer, right click on Main solution → Rename
- In Solution Explorer, right click on project (under solution) → Rename
- In Solution Explorer, double click, or right click on Properties → goto Application Tab, rename Assembly name and Default namespace to match.
- If you wish to also rename the namespace, open one of your class files. Right click the namespace → Rename.... This should search and replace all references to your namespace throughout the project.
- Close the project → rename the project folder.
- Edit the
.sln
file in Notepad, and change the path to the csproj, i.e.,fuar.csproj
→barar.csproj
.
这篇关于如何从 Visual Studio 中重命名项目文件夹?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文