Visual Studio 从某处检索到项目的不正确路径

发布于 12-08 14:32 字数 841 浏览 2 评论 0原文

Visual Studio(可能还有 TFS)不知何故(我认为可能是在源代码控制合并期间)对我的解决方案中的项目路径感到困惑。

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

C:\My Projects\ExampleSolution\ExampleProjectWrong\ExampleProjectCorrect.csproj

而实际上,项目文件位于这里:

C:\My Projects\ExampleSolution\ExampleProjectCorrect\ExampleProjectCorrect.csproj

我一生都无法让它识别正确的位置。我尝试过:

  • 从正确的位置删除并重新添加项目。出现错误消息,指出无法找到位于 C:\My Projects\ExampleSolution\ExampleProjectWrong\ExampleProjectCorrect.csproj 的项目文件

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

  • 在解决方案目录上的文件中查找正确和错误的路径,以尝试跟踪 studio 隐藏错误路径的位置。

  • 删除 VS 和 TFS 的缓存目录

我正在抓狂,因为我无法重新创建解决方案,因为它几乎没有区别 100 个项目与其他几个开发人员一起致力于源代码控制。

谁能指出正确的方向,告诉我它存储这个错误路径的位置和/或如何重置它,以便该死的东西能够正确加载?

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 Projects\ExampleSolution\ExampleProjectWrong\ExampleProjectCorrect.csproj

whereas actually, the project file is located here:

C:\My Projects\ExampleSolution\ExampleProjectCorrect\ExampleProjectCorrect.csproj

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

  • Removing and re-adding the project from the correct location. An error message comes up saying The project file at C:\My Projects\ExampleSolution\ExampleProjectWrong\ExampleProjectCorrect.csproj could not be found.

  • 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.

  • Deleting the cache directories for VS and TFS

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(14

紫﹏色ふ单纯2024-12-15 14:32:00
  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 source
    control 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.

月野兔2024-12-15 14:32:00

只需删除解决方案 .suo 文件对我有用。

Simply deleting the solutions .suo file worked for me.

难理解2024-12-15 14:32:00

在从 Visual Source Safe 2005 迁移到 TFS 2012 后,我遇到了这个问题。我迫不及待地等待未来几周内发布的“转换向导”,所以我只运行了 VSSConvert.exe。这花了 6 年左右的历史并将其移入 TFS.. 虽然我没有获得实际的时间线历史记录.. 我在同一天收到了一堆条目,其中的注释表明了历史记录的实际签入。 。 不错。

因此,在它运行了一整晚之后(成功了,耶!),正如这个问题所述,我在加载我的项目时遇到了困难。由于某种原因,一些项目被引用到了不正确的目录。我检查了 .sln、.vsproj 文件,并获取最新文件、删除重新获取、添加删除等。我尝试了此处提到的所有内容...甚至升级了我的工作区,我不确定这到底做了什么。

最后...我删除了*.suo文件和中提琴。它起作用了。

我在这个上花了几个小时。

I was facing this issue after performing a migration from Visual Source Safe 2005 to TFS 2012. I couldn't wait for the "Conversion Wizard" due out in the next couple weeks so I just ran VSSConvert.exe. This took 6 or so years of history and moved it into TFS.. while I didn't get the actual timeline history.. I got a bunch of entries on the same day with the comments indicating the actual check-ins of the history.. not bad.

So after it ran all night (Successfully, yay!), I was having trouble loading my projects just as this question stated. For some reason, a few projects were being referenced to an incorrect directory. I checked the .sln, the .vsproj files, and getting latest, deleting re-getting, adding removing, etc.. I tried everything noted here... even upgrading my workspace, which I'm not sure what that even did.

FINALLY... I deleted the *.suo files and viola. It worked.

I spent a couple hours on this one.

仲春光2024-12-15 14:32:00

稍微不同的解决方案。

TFS 显示特定解决方案的不存在路径。以前,我的笔记本电脑有一个单独的 D: 驱动器,但现在,我只有一个 C: 驱动器。 TFS 仍然认为我的项目存储在 D:\Project\MikesProject 上

,我没有要删除的 .suo 文件,D: 路径没有在任何地方提到我的工作区(隐藏在 File\Source Control\Advanced\Workspaces 菜单下),TFS 显示我的(不再存在的)D: 目录中确实有最新文件,并且 TFS 在VS2013 没有该项目的“删除映射”选项。

所做的工作只是简单地对项目执行“获取最新版本”。

执行此操作后,代码的新副本将写入我的 C: 驱动器,并且(有趣的是)现在本地路径显示为下划线

以前,D: 路径不是这样显示的。

奇怪的。很奇怪。

A slightly different solution.

TFS was displaying a non-existing path for a particular Solution. Previously, I had a laptop with a separate D: drive, but now, I just have a C: drive. TFS still thought my project was stored on D:\Project\MikesProject

I didn't have a .suo file to delete, the D: path wasn't mentioned anywhere in my Workspaces (buried away under the File\Source Control\Advanced\Workspaces menu), TFS showed that I did have the latest files in my (no-longer-existant) D: directory, and TFS in VS2013 didn't have a "Remove Mappings" option for this project.

But what did work was to simply do a "Get latest version" on the project.

After doing so, a fresh copy of the code was written to my C: drive, and (interestingly), now the Local Path was shown underlined.

Previously, the D: path wasn't shown like this.

Odd. Very odd.

镜花水月2024-12-15 14:32:00

我们在移动和重命名方面也遇到过类似的问题。
删除本地目录然后再​​次解决它。

We've had similar issues with moves and renames.
Deleting the local directories and then getting again solved it.

蓝眼睛不忧郁2024-12-15 14:32:00

即使删除了 .suo 文件和 .vs 文件夹,我也必须编辑 .sln 文件并从 中删除旧的相对 URL >SccProjectName# 尽管 SccLocalPath# 是正确的。显然 VS 也使用该名称作为提示路径。

Even after deleting the .suo file and .vs folders, I had to edit the .sln file and remove the old relative url from SccProjectName# despite the SccLocalPath# being correct. Apparently VS also uses the name as a hint path.

锦欢2024-12-15 14:32:00

尝试删除或重命名.suo 文件(包括扩展名)。该文件与您的解决方案文件位于同一位置。这对我有用。

Try to delete or rename .suo file (including extension). This file is at the same location where your solution file is. It worked for me.

心的位置2024-12-15 14:32:00

只是猜测,但也许您的其他一些项目从错误的位置引用了您的项目?在这种情况下,您不仅需要删除项目并将其重新插入到解决方案中,还必须从引用项目中删除并重新创建引用(存储在其 .csproj 文件中)。

Just guessing, but perhaps some of your other projects references your project from the wrong location? In this case, you have not just to delete and re-insert the project into your solution, you will also have to delete and recreate the references from the referencing projects (stored in their .csproj files).

谜兔2024-12-15 14:32:00

在尝试了很多建议之后,我删除了 suo 文件(再次)。上次工作了。我不知道为什么它不能早点工作。一般来说,我发现删除 suo 文件是我所做的第一步。

After trying many recommendations I deleted the suo file ( again ). The last time worked. Why it did not work earlier I do not know. In general I find deleting the suo file one of the first steps I do.

谈场末日恋爱2024-12-15 14:32:00

我从我的开发分支打开了我的 asp.net 网站解决方案。
然后出于其他目的,我从主分支打开了相同的解决方案。

我对 dev 分支中的一个 .ascx.cs 文件进行了更改并设置了断点。当我运行调试器时,除了击中主分支的 .ascx.cs 之外,所有断点都在开发分支中击中。不知道。

尝试清理临时文件夹但没有用。

有效方法:

关闭 Visual Studio 的所有实例

再次从 Dev 分支打开解决方案。

再次运行,断点开始出现。

I had my asp.net website solution opened from my Dev Branch.
Then for some other purpose I opened same solution from Main branch.

I made a change to one of my .ascx.cs file in the dev branch and set breakpoint. When I ran the debugger, all my break points were hit in the Dev Branch except for the .ascx.cs which was hitting the Main branch. Have not idea.

Tried cleaning the Temporary folder but didn't work.

What worked:

Closed all instances of Visual Studio

Opened the solution from Dev branch again.

Run again and the break points started hitting.

2024-12-15 14:32:00

就我而言,我将 *.sln 文件复制到项目文件夹中,并将项目路径更改为 *.sln 文件。只有这样才解决了问题(相对于 2015 sp1,winservise 项目)。

删除 *.suo 对我没有帮助。

In my case i copied the *.sln file into the project folder and changed the path to project into the *.sln file. Only this resolved the problem (vs 2015 sp1, winservise project).

Delete *.suo does not helps for me.

猫瑾少女2024-12-15 14:32:00

还有另一个解决方案对我们有用 - 在尝试删除 suo 以及该线程中提到的几乎所有内容之后。我们的解决方案中有一个项目,它显示了 csproj 文件的幽灵版本。我们删除了该文件,并将路径固定在我们试图添加的另一个项目上。

Yet another solution worked for us - after trying the delete of suo and almost everything mentioned in this thread. We had a project in the solution which was showing a ghost version of the csproj file. We deleted that file and our paths fixed on another project we were trying to add.

白云不回头2024-12-15 14:32:00

删除 obj 和 bin 文件即可解决问题...

Deleting obj and bin files would solve the problem...

谁许谁一生繁华2024-12-15 14:32:00

我知道这是一条老线。我刚刚经历了同样的问题。我们最近迁移了 TFS,因此我创建了一个新工作区来映射到新服务器并保留旧工作区。每次当我打开一个应该针对我的新工作区的解决方案时,VS 总是尝试从我的旧映射目录加载项目,直到我删除了我的旧工作区。

I know it is an old line. I just went through the same problem. We recently migrate the TFS, so I created a new workspace to map to new server and kept the old one. Every time when I open a solution which is supposed to target to my new workspace, VS always tried to load projects from my old mapping directory, till I removed my old workspace.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文