visual-studio 项目文件已移动重命名或不在您的计算机上

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2002088/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-22 11:21:27  来源:igfitidea点击:

The project file has been moved renamed or is not on your computer

visual-studiotfsvisual-studio-2008

提问by sineas

I get this error when I try to load a VS 2008 project from TFS source control:

当我尝试从 TFS 源代码管理加载 VS 2008 项目时出现此错误:

The project file has been moved, renamed or is not on your computer

项目文件已被移动、重命名或不在您的计算机上

After I click OK the project says "unavailable". What is the problem? How do I resolve this? I never had this problem before. Some blogs said to delete the .suo file but I can't locate the .suo file. I deleted the entire project on my local computer so that the next time it opens it will create a new one, but I still get same error.

单击“确定”后,项目显示“不可用”。问题是什么?我该如何解决?我以前从未遇到过这个问题。有些博客说要删除.suo 文件,但我找不到.suo 文件。我删除了本地计算机上的整个项目,以便下次打开它时会创建一个新项目,但我仍然遇到相同的错误。

回答by Stanley.Goldman

What typically helps to fix it is deleting the Solution User Options aka "SUO".

通常有助于修复它的是删除解决方案用户选项又名“SUO”。

VS up to 2013

与 2013 年相比

In the older VS it is stored as a "hidden" SolutionName.suoin the same folder as the main .slnfile.

在较旧的 VS 中,它作为“隐藏”存储SolutionName.suo在与主.sln文件相同的文件夹中。

VS2015 or later

VS2015 或更高版本

In VS2015 the same data was moved to a "hidden" .vsfolder under the same folder as the main .slnfile.

在 VS2015 中,相同的数据被移动到.vs与主.sln文件相同的文件夹下的“隐藏”文件夹中。

回答by AndreasV

I just ran into this issue using VS 2013 after renaming a project. Stanley's answer guided me to the solution:

在重命名项目后,我刚刚使用 VS 2013 遇到了这个问题。斯坦利的回答引导我找到解决方案:

Close VS - delete .suo file - start VS again.

关闭 VS - 删除 .suo 文件 - 再次启动 VS。

回答by Mikhael Loo

Delete the .suo file in a special way.

以特殊方式删除 .suo 文件。

  1. Don't have the solution open when you delete the hidden .suo file.
  2. Restart VisualStudio.
  3. Open solution and Add project without error message.
  1. 删除隐藏的 .suo 文件时不要打开解决方案。
  2. 重新启动 VisualStudio。
  3. 打开解决方案并添加项目,没有错误消息。

回答by Jason Williams

TFS works like most source control packages: It remembers what it has put on your computer so that when you "Get Latest" it only has to get the chnages since your last "Get" instead of having to get absolutely everything.

TFS 的工作方式与大多数源代码控制包类似:它会记住它在您的计算机上放置的内容,因此当您“获取最新信息”时,它只需获取自上次“获取”以来的更改,而不必获取所有内容。

This has one caveat: If you delete or rename the local files on your disk, TFS won't know that you have done this, and it will still think they are where it left them.

这有一个警告:如果您删除或重命名磁盘上的本地文件,TFS 不会知道您已完成此操作,并且仍会认为它们在原处。

If you then "Get Latest" it will not bother to update the missing files.

如果您然后“获取最新信息”,它就不会费心更新丢失的文件。

You are then likely to get all kinds of "missing file" errors, from TFS and any other tools that look for the files.

然后,您可能会从 TFS 和任何其他查找文件的工具中获得各种“丢失文件”错误。

To get around it, you need to:

要绕过它,您需要:

  • If you think you might have any changes in there that you don't want to lose, copy the source folder on your PC as a back up just in case!
  • Right click on the project (in Solution Explorer) or folder (in Source Control)
  • Choose "Get Specific Version" from the context menu
  • Choose to get the "Latest Version" and tick the option that says (something like) "force get of files already in your workspace", which tells TFS to forget about what it "knows" and get all the files again anyway.
  • 如果您认为其中可能有任何不想丢失的更改,请复制 PC 上的源文件夹作为备份以防万一!
  • 右键单击项目(在解决方案资源管理器中)或文件夹(在源代码管理中)
  • 从上下文菜单中选择“获取特定版本”
  • 选择获取“最新版本”并勾选(类似)“强制获取工作区中已有文件”的选项,这会告诉 TFS 忘记它“知道”的内容并再次获取所有文件。

If you have any locally-changed (writable) files, then be careful. There is a second option that will overwrite these, losing your changes. But you have the backup, so you should be safe. It's generally better to tick this option as well to make sure that all your source code is completely up to date. (But obviously only if you don't mind losing any local changes!)

如果您有任何本地更改(可写)的文件,请小心。还有第二个选项会覆盖这些,丢失您的更改。但是你有备份,所以你应该是安全的。通常最好也勾选此选项以确保您的所有源代码都是最新的。(但显然只有在您不介意丢失任何本地更改的情况下!)

When you OK, this will forcibly get all the files in the project to your local drive, and should correct the problem.

当您确定后,这将强制将项目中的所有文件放到您的本地驱动器中,并且应该可以解决问题。

回答by sandeep talabathula

Though it's well known VS defect, definately we can handle it!

虽然这是众所周知的VS缺陷,但我们绝对可以处理!

  • Open the solution file in edit mode

  • Modify the relative path to match the modified/moved physical path ..

    SccProjectUniqueName1 = Source\Order\Order.csproj
    SccProjectName1 = Order.ApplicationService
    SccLocalPath1 = Order.ApplicationService
    
  • Also, makesure of correct relative path for the referring project(s)

    Project("{asdasd-301F-11D3-BF4B-asdasd}") = "Order",
            "Source\Order\Order.csproj", "{E25641BC-C990-40E2-8876-08AE8728F763}"
    EndProject
    
  • 在编辑模式下打开解决方案文件

  • 修改相对路径以匹配修改/移动的物理路径..

    SccProjectUniqueName1 = Source\Order\Order.csproj
    SccProjectName1 = Order.ApplicationService
    SccLocalPath1 = Order.ApplicationService
    
  • 此外,确保引用项目的正确相对路径

    Project("{asdasd-301F-11D3-BF4B-asdasd}") = "Order",
            "Source\Order\Order.csproj", "{E25641BC-C990-40E2-8876-08AE8728F763}"
    EndProject
    

回答by Lilith River

Try opening the .csproj or .vbproj instead of the .sln. What has probably happened is the .sln (solution) file has a absolute file reference (instead of a relative path) to the compoenent project(s). You may need to re-create the .sln, or hand-edit it.

尝试打开 .csproj 或 .vbproj 而不是 .sln。可能发生的情况是 .sln(解决方案)文件具有到组件项目的绝对文件引用(而不是相对路径)。您可能需要重新创建 .sln,或手动编辑它。

回答by Arun Vinoth

Easiest option worked out for me is:

对我来说最简单的选择是:

  1. Right click the project & Remove the "not loaded" or "unavailable" project
  2. Right click the solution & Add "Existing Project"
  1. 右键单击项目并删除“未加载”或“不可用”项目
  2. 右键单击解决方案并添加“现有项目”

回答by Chris Schiffhauer

In my case, deleting the .suo file was insufficient. I discovered that my workspace configuration had an error. I discovered and resolved the problem with these steps:

就我而言,删除 .suo 文件是不够的。我发现我的工作区配置有错误。我通过以下步骤发现并解决了问题:

  1. In Team Explorer, "Manage Workspaces..."

    enter image description here

  2. Click "Edit..."

    enter image description here

  3. Correct the value under "Local Folder"

    enter image description here

  4. Finally, delete the affected .suo files per the accepted answer.

  1. 在团队资源管理器中,“管理工作区...”

    在此处输入图片说明

  2. 点击“编辑...”

    在此处输入图片说明

  3. 更正“本地文件夹”下的值

    在此处输入图片说明

  4. 最后,根据接受的答案删除受影响的 .suo 文件。

回答by David

I found it easiest to create a new Solution sln file.

我发现创建一个新的解决方案 sln 文件最容易。

回答by Sayward

I ran into this issue and was able to resolve it by obtaining the .rptprojfiles from a co-worker and copying them into my local directory. The project was then able to re-load.

我遇到了这个问题,并且能够通过.rptproj从同事那里获取文件并将它们复制到我的本地目录来解决它。然后该项目能够重新加载。