visual-studio 为什么会显示“解决方案中已打开具有该名称的项目”?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/923235/
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 10:33:33  来源:igfitidea点击:

Why does it say "Project with that name already opened in the solution"?

visual-studiotfs

提问by Mike K.

I recently migrated a VSS database to TFS 2008. Using Source Control Explorer, I got the latest version of a solution with 12 projects.

我最近将一个 VSS 数据库迁移到 TFS 2008。使用 Source Control Explorer,我获得了一个包含 12 个项目的解决方案的最新版本。

When I opened the solution in VS 2005, two of the projects were not found. I am not sure why these two projects were not found, but thought it easiest to just delete and re-add them to the solution.

当我在VS 2005中打开解决方案时,没有找到两个项目。我不确定为什么没有找到这两个项目,但认为最简单的方法是将它们删除并重新添加到解决方案中。

When I do this, VS gives me a "A project with that name is already open in the solution." The project doesn't appear in solution explorer, and is not listed in the .sln file.

当我这样做时,VS 给我一个“具有该名称的项目已在解决方案中打开”。该项目未出现在解决方案资源管理器中,也未在 .sln 文件中列出。

Any ideas?

有任何想法吗?

采纳答案by Tuomas Hietanen

I had the same message... Seems like it comes from (.csproj) project file. Under first propertygroup there is a section named

我有同样的消息......似乎它来自(.csproj)项目文件。在第一个属性组下有一个名为的部分

<ProjectTypeGuids>...</ProjectTypeGuids> 

which generally tells Visual Studio to handle that project in some specific way. Some Guids can be found here.

这通常告诉 Visual Studio 以某种特定方式处理该项目。可以在此处找到一些指南。

First make a backup copy of that file. Then removing that section can help you open the project as usual project. As it seems that the Visual Studio thinks that the project is not the type that is specified in the ProjectTypeGuids.

首先制作该文件的备份副本。然后删除该部分可以帮助您像往常一样打开项目。似乎 Visual Studio 认为该项目不是 ProjectTypeGuids 中指定的类型。

回答by Ismail Hawayel

I had this problem and I was able to solve it using the following steps:

我遇到了这个问题,我能够使用以下步骤解决它:

  1. Remove the project from the solution.
  2. restart visual studio.
  3. add the project to the solution as an existing project.
  1. 从解决方案中删除项目。
  2. 重新启动视觉工作室。
  3. 将该项目作为现有项目添加到解决方案中。

回答by Thomas

If anyone uses AnkhSVN instead of TFS, it's also possible, that the .sln-file need the following lines:

如果有人使用 AnkhSVN 而不是 TFS,也有可能 .sln 文件需要以下几行:

GlobalSection(SubversionScc) = preSolution
    Svn-Managed = True
    Manager = AnkhSVN - Subversion Support for Visual Studio
EndGlobalSection

in the "Global" section.

在“全局”部分。

回答by JNochowitz

Delete .suo file. Build solution. Add Projects.

删除 .suo 文件。构建解决方案。添加项目。

回答by beltry

I have to say that removing the section <ProjectTypeGuids>...</ProjectTypeGuids>could create some problems. In fact, such a section defines the type of the project and, if removed, could disable some features. For example, if your project was originally defined as Smart Device (C#), after removing the aforementioned section the on-device debug may not working properly.

我不得不说,删除该部分<ProjectTypeGuids>...</ProjectTypeGuids>可能会产生一些问题。事实上,这样的部分定义了项目的类型,如果删除,可能会禁用某些功能。例如,如果您的项目最初定义为智能设备 (C#),则在删除上述部分后,设备上的调试可能无法正常工作。

回答by devXen

This did it for me:

这为我做到了:

  1. remove the section <ProjectTypeGuids>...</ProjectTypeGuids>in each project
  2. reopen each project, then save to overwrite the existing project file, finally exit
  3. reopen the solution file
  4. pray (optional)
  1. 删除<ProjectTypeGuids>...</ProjectTypeGuids>每个项目中的部分
  2. 重新打开每个项目,然后保存覆盖现有的项目文件,最后退出
  3. 重新打开解决方案文件
  4. 祈祷(可选)

回答by Dolphin

I would try hand editing the project/solution files, they are text and pretty easy to read. You can edit the file in notepad. To open up the file as text in visual studio you need to first close the solution. Then do file->open and select the sln file, but instead of hitting the open button, press on the right side where there is an arrow and select open with.. from there you can select source code editor (text).

我会尝试手动编辑项目/解决方案文件,它们是文本并且很容易阅读。您可以在记事本中编辑该文件。要在 Visual Studio 中以文本形式打开文件,您需要先关闭解决方案。然后执行 file->open 并选择 sln 文件,但不是点击打开按钮,而是按右侧有箭头的位置并选择打开方式.. 从那里您可以选择源代码编辑器(文本)。

回答by Andy

I had the same problem when i migrated a website to a web app project.

当我将网站迁移到 Web 应用程序项目时,我遇到了同样的问题。

  1. Unload the web app.
  2. Add the existing website.
  3. Reload the web app.
  1. 卸载网络应用程序。
  2. 添加现有网站。
  3. 重新加载 Web 应用程序。

回答by TheLegendaryCopyCoder

The following worked for me when I moved a project running vs2010 to another laptop.

当我将运行 vs2010 的项目移动到另一台笔记本电脑时,以下对我有用。

I removed exactly the following and it worked:

我完全删除了以下内容并且它起作用了:

<ProjecctType>Guid of sorts</ProjectType>
<SccProjectName>Svn</SccProjectName>
<SccLocalPath>Svn</SccLocalPath>
<SccAuxPath>Svn</SccAuxPath>
<SccProvider>SubversionScc</SccProvider>

回答by jpsfs

For those looking for this while dealing with VSTO projects...

对于那些在处理 VSTO 项目时寻找这个的人......

Be sure to have the Office Tools for Visual Studio installed in your machine before opening the project.

在打开项目之前,请务必在您的计算机中安装 Visual Studio 的 Office 工具。