我有一个相当复杂的Visual Studio解决方案(2010年,但这不重要),我需要重命名。
我想重命名文件夹以匹配新的解决方案名称,但我无法找到自动重构文件夹名称的方法,而且查看每个项目文件将是一件痛苦的事情。
有官方的做法吗?
我有一个相当复杂的Visual Studio解决方案(2010年,但这不重要),我需要重命名。
我想重命名文件夹以匹配新的解决方案名称,但我无法找到自动重构文件夹名称的方法,而且查看每个项目文件将是一件痛苦的事情。
有官方的做法吗?
当前回答
重命名网站:
http://www.c-sharpcorner.com/Blogs/46334/rename-website-project-in-visual-studio-2013.aspx
定位并编辑IISExpress的applicationhost。配置,在这里找到: C: \用户{username} \ \ IISExpress \ config文件
其他回答
The Rename operations in Visual Studio only change the filename, i.e. *.prj for a project, and *.sln for a solution. You will need to rename folders separately using the filesystem, and you will need to remove and re-add the projects since they will have new folder names. However, note that the solution and project files are respectively text and xml files. You could write your own program that parses them and renames both the folder names, filenames, and fixes the project/solution files internally.
重命名网站:
http://www.c-sharpcorner.com/Blogs/46334/rename-website-project-in-visual-studio-2013.aspx
定位并编辑IISExpress的applicationhost。配置,在这里找到: C: \用户{username} \ \ IISExpress \ config文件
如果在遵循建议的解决方案之后,您已经设法重命名了一个新的解决方案(假设从www.oldsite.com重命名为www.newsite.com),但仍然使用旧的Web站点项目名称,因为您有一个旧的“ASP。Net Web站点”,然后遵循这些额外的步骤(假设从project1到project2)。
安装和旧的Visual Studio 2017 用它打开项目,右键单击项目->添加->新建项目。 选择“已安装-> Visual c# -> Web ->以前版本-> ASP. exe”。NET空网站”并将其命名为“www.newsite.com” 将Visual Studio 2017中的所有文件和文件夹从旧站点移动到新站点,直到旧站点仍然为空。 右键单击“www.oldsite.com”并删除它。
现在您可以保存所有内容,并使用Visual Studio 2022再次打开它。所有这些都是需要的,因为VS2019/VS2020不支持“旧的”ASP。Net网站创建,但只编辑。
我遵循https://gist.github.com/n3dst4/b932117f3453cc6c56be链接,我能够重命名我的整个解决方案成功。
2021年更新:
重命名项目使这变得毫不费力。一个简单的CLI工具,它甚至在成功时创建一个git提交。
https://github.com/ModernRonin/ProjectRenamer
旧的回答:
我曾经使用Visual Studio扩展“完全重命名项目”来成功地重命名ASP中的项目。NET Core 2解决方案。
我使用ReSharper然后调整名称空间(右键单击项目,重构,调整名称空间…)
https://github.com/kuanysh-nabiyev/RenameProjectVsExtension