如何在不杀死解决方案的情况下重命名项目 [英] how to rename a project without killing solution
问题描述
当我在解决方案中重命名项目,然后尝试构建该项目时,出现错误:找不到项目文件xyz.csproj".其中 xyz 是旧项目文件名!
When I rename a project within a solution, and then try and build that project, I get the error: "The project file "xyz.csproj" was not found. Where xyz is the old project file name!
烦人的是我可以搜索我的项目 &旧项目文件名的解决方案,搜索将一无所获,当我点击错误时VS什么也不做.
The annoying thing is that I can search my project & solution for the old project file name, and the search will come up with nothing, and when I click on the error VS does nothing.
因此似乎无法找到旧参考的位置.
So there seems to be no way of finding where the old reference is.
这是一个托管 Silverlight 页面的 .web 项目(如果有什么不同的话).
This is a .web project hosting a silverlight page, if that makes any difference.
推荐答案
这些是我重命名项目时遵循的步骤:
These are steps I follow when I rename a project:
- 点击解决方案中的项目并重命名.这将重命名 .proj 文件和项目名称(但不是包含项目的目录).
- 关闭解决方案,重命名项目文件夹.在此阶段,解决方案仍会引用旧文件夹.
- 打开 sln 文件并将旧文件夹名称替换为新名称.这应该只在一个地方.它看起来像这样.
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SolutionName", "OldProjectNameNewProjectName.csproj", "{98644DD0-5AB5-4CAC-8D83-CCB8EEEFE234}"
你需要让它看起来像这样:
You will need to make it look like this:
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SolutionName", "NewProjectNameNewProjectName.csproj", "{98644DD0-5AB5-4CAC-8D83-CCB8EEEFE234}"
这篇关于如何在不杀死解决方案的情况下重命名项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!