本文介绍了Visual Studio 从某处检索项目的错误路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Visual Studio(也可能是 TFS)以某种方式(我认为可能是在源代码管理合并期间)对我的解决方案中的项目路径感到困惑.

Visual Studio (and possibly TFS) has somehow (I think perhaps during a source control merge) become confused about the path of a project within my solution.

它认为它在这里(为简单起见,示例路径):

It thinks it is here (example paths for simplicity):

C:My ProjectsExampleSolutionExampleProjectWrongExampleProjectCorrect.csproj

而实际上,项目文件位于此处:

whereas actually, the project file is located here:

C:My ProjectsExampleSolutionExampleProjectCorrectExampleProjectCorrect.csproj

我这辈子都无法识别正确的位置.我试过了:

I cannot for the life of me get it to recognize the correct location. I have tried:

  • 从正确的位置删除并重新添加项目.出现一条错误消息,指出找不到位于 C:My ProjectsExampleSolutionExampleProjectWrongExampleProjectCorrect.csproj 的项目文件.

手动编辑 .sln 文件以确保对 ExampleProjectCorrect.csproj 的所有引用都具有正确的路径.

Manually editing the .sln file to ensure all references to ExampleProjectCorrect.csproj have the correct paths.

在解决方案目录中的文件中查找正确和不正确的路径,尝试找出工作室隐藏错误路径的位置.

Doing a find in files on the solution directory for both the correct and incorrect paths, to try and track down where studio is hiding the incorrect path.

删除 VS 和 TFS 的缓存目录

Deleting the cache directories for VS and TFS

我正在纠结,因为我无法重新创建解决方案,因为它几乎与 100 个项目没有任何区别,并且与其他几位开发人员的源代码控制相关联.

I'm tearing my hair out because I can't recreate the solution as it has near as makes no difference 100 projects in and is tied in to source control with several other developers working on it.

谁能给我指出正确的方向,让我知道它在哪里存储这个错误的路径和/或如何重置它以便该死的东西可以正确加载?

Can anyone point me in the right direction as to where it is storing this incorrect path and/or how to reset it so the damn thing will load correctly?

推荐答案

  1. 转到管理工作区(通过文件/源代码管理菜单或源代码管理资源管理器中的工作区下拉菜单)
  2. 为您的工作区选择编辑.
  3. 您应该在工作文件夹下看到源的映射控制目录到旧的/错误的项目目录.
  4. 选择它并点击删除.
  5. 关闭VS并删除suo文件.
  1. Go to Manage Workspaces (either through the File/Source Control menu or the workspace drop down in Source Control Explorer)
  2. select edit for your workspace.
  3. You should see, under working folders, a mapping for the sourcecontrol directory to the old/wrong project directory.
  4. Select it and click remove.
  5. Close VS and delete the suo file.

它仍然引用了错误的目录.也许在这一点上重新绑定可能会起作用,但我没有尝试过.重新加载您的项目,您应该一切顺利.

It still references the wrong directory. Maybe rebinding might work at this point but I didn't try that. Reload your project and you should be good to go.

这篇关于Visual Studio 从某处检索项目的错误路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-06 02:27