当我试图打开一个项目,本地或在团队基础服务器(TFS),我得到一个模态窗口告诉我:

操作无法完成:未指明的错误

或者是同样的消息,但是“类未定义..”而不是“未指定的错误”。

这些错误在今天早些时候开始发生,当时我试图将我的一些工作签入到团队基础服务器。我尝试在同一台计算机上使用Visual Studio 2008,但我仍然得到相同的错误。我也在谷歌上搜索过,但似乎没有一个解决方案能帮到我。

我也安装了Windows Update的最新更新。

什么好主意吗?


当前回答

您是否尝试删除Your_Solution_FileName. exe文件。缩文件?

.suo文件应该与你的.sln文件在同一个文件夹中,对于更新版本的Visual Studio,应该在.vs文件夹中。.vs文件夹可能被隐藏。


更新Visual Studio 2017 在VS 2017中。suo文件位于不同的文件夹中:您可以在YourSolutionFolder\.vs\YourSolutionName\v15\.suo中找到。suo文件

.vs文件夹是隐藏的,.suo文件是一个没有名称的文件,只有.suo扩展名。


  解释

.suo文件包含各种信息,如打开的文件列表,以及一些未保存在解决方案文件中的首选项(如启动项目)和其他内容。

通常情况下,删除.suo文件没有问题。之后,您可能必须为解决方案设置StartUp项目。

为了安全起见,您可以重命名.suo文件,然后重试启动解决方案,看看这是否有帮助。

根据我的经验,有时VS在启动时崩溃,因为一些源代码中有错误,由于这个错误,VS无法编译代码,然后崩溃,因为没有编译代码,它无法在设计模式中显示形式。 在这种情况下,删除.suo文件将解决这种情况,因为它重置了打开的文件列表,因此解决方案可以在不打开/显示任何文件的情况下启动。


当删除.suo文件无效时 当删除.suo文件不能解决问题时,您可以尝试以下其他方法:

Restart the computer Clean Windows temp folder Clean the solution from the IDE (Menu\Build\Clean Solution) Clean the solution manually (delete the compiled DLL/EXE in the /bin/ folder and empty the temporary files that VS create during the build process in the /obj/ folder (each project that compose the solution has these folders, so clean them all)) Try to open each single project that compose the solution 1-by-1 and build it, to understand which is the specific project that generate the issue Understand what is the change/edit/modification that triggered the error, and undo it (source control tool can help...) If you have custom controls: check the code in the constructor. The VS IDE will call the constructor of your custom controls even at design time, and weird things can happen (at design time some properties dont works, your connection string probably isn't populated...)

作为最后的手段……

尝试安装任何VS更新 尝试禁用VS扩展(如果你安装了任何…) 尝试更新解决方案中引用的任何外部DLL/控件 尝试更新Windows

其他回答

以上的解决方案对我都不起作用。但下面的问题却起了作用:

在Windows资源管理器中打开当前文件夹 手动将文件夹移动到所需位置 打开.csproj文件。然后VS会自动创建.sln文件。

您是否尝试删除Your_Solution_FileName. exe文件。缩文件?

.suo文件应该与你的.sln文件在同一个文件夹中,对于更新版本的Visual Studio,应该在.vs文件夹中。.vs文件夹可能被隐藏。


更新Visual Studio 2017 在VS 2017中。suo文件位于不同的文件夹中:您可以在YourSolutionFolder\.vs\YourSolutionName\v15\.suo中找到。suo文件

.vs文件夹是隐藏的,.suo文件是一个没有名称的文件,只有.suo扩展名。


  解释

.suo文件包含各种信息,如打开的文件列表,以及一些未保存在解决方案文件中的首选项(如启动项目)和其他内容。

通常情况下,删除.suo文件没有问题。之后,您可能必须为解决方案设置StartUp项目。

为了安全起见,您可以重命名.suo文件,然后重试启动解决方案,看看这是否有帮助。

根据我的经验,有时VS在启动时崩溃,因为一些源代码中有错误,由于这个错误,VS无法编译代码,然后崩溃,因为没有编译代码,它无法在设计模式中显示形式。 在这种情况下,删除.suo文件将解决这种情况,因为它重置了打开的文件列表,因此解决方案可以在不打开/显示任何文件的情况下启动。


当删除.suo文件无效时 当删除.suo文件不能解决问题时,您可以尝试以下其他方法:

Restart the computer Clean Windows temp folder Clean the solution from the IDE (Menu\Build\Clean Solution) Clean the solution manually (delete the compiled DLL/EXE in the /bin/ folder and empty the temporary files that VS create during the build process in the /obj/ folder (each project that compose the solution has these folders, so clean them all)) Try to open each single project that compose the solution 1-by-1 and build it, to understand which is the specific project that generate the issue Understand what is the change/edit/modification that triggered the error, and undo it (source control tool can help...) If you have custom controls: check the code in the constructor. The VS IDE will call the constructor of your custom controls even at design time, and weird things can happen (at design time some properties dont works, your connection string probably isn't populated...)

作为最后的手段……

尝试安装任何VS更新 尝试禁用VS扩展(如果你安装了任何…) 尝试更新解决方案中引用的任何外部DLL/控件 尝试更新Windows

在错误发生后,我从解决方案中删除了一个旧项目。我不得不在记事本中打开.sln文件并删除我删除的旧项目的.dll引用。从那以后,它起作用了。

重新启动Visual Studio解决了我的问题:)

对我来说,这个问题是由下面文件中冲突的<site>配置引起的。

C:\Users\smunro\Documents\IISExpress\config\applicationhost.config

我编辑了这个文件,以删除以下元素中的所有站点元素。您可能想要更有选择性,尝试识别导致冲突的站点并删除它。

<configuration><system.applicationHost><sites>

注意,我在这里保留了<siteDefaults>、<applicationDefaults>和<virtualDirectoryDefaults>元素。

当我重新加载项目时,一个新的<site>元素被自动创建。