在TFS下重命名VS.net中包含的项目文件夹
我有一个 vs.net 项目,经过一些重构,修改了项目的名称。 如何轻松重命名底层 Windows 文件夹名称以匹配 TFS 控制的项目和解决方案下的新项目名称?
请注意,我过去可以通过使用 SourceSafe 在后台摆弄东西来完成......
I have a vs.net project, and after some refactoring, have modified the name of the project. How can I easily rename the underlying windows folder name to match this new project name under a TFS controlled project and solution?
Note, I used to be able to do by fiddling with things in the background using SourceSafe ...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
对于 Visual Studio 2019 和 ASP.NET Core 2.2 我必须稍微修改 Scott Munro 的答案。 以下是对我有用的方法:
开始之前:签入所有更改并备份您的解决方案。
我必须先执行步骤 1,以便在步骤 3 中修复文件路径后加载项目。
For Visual Studio 2019 and ASP.NET Core 2.2 I had to modify Scott Munro's answer slightly. Here's what worked for me:
Before you start: Check in all changes and make a backup of your solution.
I had to do step 1 first in order to get the project to load after fixing the file path in step 3.
我的具体配置是VS2010连接到TFS2008。 我在这里尝试了一些其他解决方案,但遇到了问题。 我发现以下内容对我有用: -
现在,您将重命名文件夹并将解决方案重新映射在一个变更集下提交的所有内容。
My particular configuration is VS2010 connecting to TFS2008. I tried some of the other solutions here, but had problems. I found the following worked for me:-
Now, you'll have the folder rename and the solution re-map all committed under one changeset.
您可以在 TFS 中重命名项目(.Xproj 文件和项目文件夹),删除本地文件夹结构及其所有内容,然后获取项目的最新版本。 所有这一切都取决于您的源存储库的概念是否完全是最新的且可编译的。
You could just rename the project (.Xproj file and project folder) in TFS, delete the local folder structure and all of its contents, then do a get latest for the project. All of this depends the notion of your source repository is completely up to date and compilable.
以下是在使用 TFS 的 Visual Studio 2008 中对我有用的步骤:
或者:在步骤 2 之后,您可以在文本编辑器中打开解决方案的 .sln 文件,然后手动更新项目文件夹名称。 如果您这样做,您可能需要手动签出 .sln 文件以确保您的更改将被签入(<- 重要!)。
Here are steps that worked for me in Visual Studio 2008 with TFS:
OR: After step 2, you can open the solution's .sln file in a text editor, and manually update the project folder names. If you do this, you might need to manually check-out the .sln file to be sure your changes will be checked in (<- important!).
只需右键单击 TFS 中的文件夹,然后选择重命名。 提交重命名后,TFS 将为您在磁盘上进行更改。 正如 Kevin 指出的那样,您需要确保所有内容都已签入,因为 TFS 将删除旧文件夹及其中的所有内容,并下拉重命名的文件夹以及其中文件的当前版本。
最后一点:您无法重命名未映射的文件夹或未从中执行“获取”操作的文件夹。 我不知道为什么,但在这些情况下 TFS 将禁用“重命名”选项。
如果我没记错的话,至少这就是发生在我身上的事情。
Just right click on the folder in TFS, and select Rename. Once you commit the rename, TFS will make the changes on disk for you. As Kevin pointed out, you will want to make sure that everything is checked in, because TFS will remove the old folder and everything in it, and pull down the renamed folder with the current version of the files in it.
One final note: You can't rename a folder that you haven't mapped, or that you haven't done a "Get" from. I don't know why, but TFS will disable the Rename option in these cases.
At least that's what happened to me, if I remember correctly.
否
”。 您将收到一条警告,指出无法加载解决方案中的项目之一。<块引用>
请注意,它将显示为灰色并标记为“不可用”。
...
”按钮编辑“文件路径”属性。<块引用>
另请注意,此属性只能在 Visual Studio 中编辑2010 年。 在较新版本的 Visual Studio 中,您需要手动编辑解决方案文件中的项目路径。
如果执行这些步骤,那么您还可以考虑重命名以下内容以适应。
此外,请考虑修改以下程序集属性的值< /a>.
AssemblyProductAttribute
AssemblyDescriptionAttribute
AssemblyTitleAttribute
No
' when prompted to get projects that were newly added to the solution from source control. You will get a warning that one of the projects in the solution could not be loaded....
' button.If you perform these steps then you might also consider renaming the following to suit.
Also, consider modifying the values of the following assembly attributes.
AssemblyProductAttribute
AssemblyDescriptionAttribute
AssemblyTitleAttribute