.net Visual Studio 弹出窗口:“操作无法完成”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9079466/
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
Visual Studio popup: "the operation could not be completed"
提问by nbon
When I try to open a project, local or on a Team Foundation Server(TFS), I get a modal window telling me that:
当我尝试在本地或Team Foundation Server(TFS)上打开一个项目时,我收到一个模态窗口,告诉我:
The operation could not be completed: Unspecified error
操作无法完成:未指定的错误
Or the same message, but with "Class not defined.." instead of "Unspecified error".
或相同的消息,但使用“未定义类..”而不是“未指定的错误”。
These errors started happening earlier today when I tried to check in some of my work to the team foundation server. I have tried using Visual Studio 2008 on the same computer, but I still get the same error. I've also googled for it but none of the solutions seems to help me.
今天早些时候,当我尝试将我的一些工作签入团队基础服务器时,这些错误开始发生。我曾尝试在同一台计算机上使用 Visual Studio 2008,但仍然出现相同的错误。我也用谷歌搜索过,但似乎没有一个解决方案对我有帮助。
I have installed the latest updates from Windows Update as well.
我也安装了来自 Windows Update 的最新更新。
Any ideas?
有任何想法吗?
回答by Max
Have you tried to delete the Your_Solution_FileName.suofile?
您是否尝试删除该Your_Solution_FileName.suo文件?
The .suofile should be in the same folder as your .slnfile, or in the .vsfolder for newer versions of Visual Studio. The .vsfolder might be hidden.
该.suo文件应与您的.sln文件位于同一文件夹中,或者位于.vs较新版本的 Visual Studio的文件夹中。该.vs文件夹可能已隐藏。
Update for Visual Studio 2017
In VS 2017 the .suofiles are located in a different folder: you can find the .suofile in YourSolutionFolder\.vs\YourSolutionName\v15\.suo
Visual Studio 2017 更新
在 VS 2017 中,.suo文件位于不同的文件夹中:您可以.suo在YourSolutionFolder\.vs\YourSolutionName\v15\.suo
The .vsfolder is hidden, and the .suofiles is a file without name, with just the .suoextension.
该.vs文件夹是隐藏的,而.suo文件是没有名字的文件,只用.suo扩展。
?
Explanation
?
解释
The .suofile contain various information like the opened files list, and some preferences that are not saved in the solution file (like the starting project) and other things.
该.suo文件包含各种信息,如打开的文件列表,以及一些未保存在解决方案文件中的首选项(如启动项目)等。
Normally you can delete the .suofile without problems. You might have to set the StartUp Projectfor your solution afterwards.
通常,您可以.suo毫无问题地删除文件。之后您可能必须StartUp Project为您的解决方案设置。
Just to stay on the safe way, you can rename the .suofile, and then retry to start the solution, to see if this help.
为了安全起见,您可以重命名.suo文件,然后重试启动解决方案,看看是否有帮助。
In my experience sometime VS crash on start because there is an error in some source code, and due to that error VS can't compile the code, and then crash because without compiled code it's unable to show form in design mode.
In this case, deleting the .suofile will solve the situation because it reset the open files list, so the solution can start up without opening/showing any files.
根据我的经验,有时 VS 在启动时崩溃,因为某些源代码中存在错误,并且由于该错误 VS 无法编译代码,然后崩溃,因为没有编译代码它无法在设计模式下显示表单。在这种情况下,删除.suo文件将解决该情况,因为它会重置打开的文件列表,因此该解决方案可以在不打开/显示任何文件的情况下启动。
When deleting the .suo file doesn't works
Here's a list of other things you can try when deleting the .suofile doesn't resolve the issue:
删除 .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...)
- 重新启动计算机
- 清理 Windows 临时文件夹
- 从 IDE 中清除解决方案 (Menu\Build\Clean Solution)
- 手动清理解决方案(删除
/bin/文件夹中编译好的DLL/EXE,并清空文件夹中VS在构建过程中创建的临时文件/obj/(组成解决方案的每个项目都有这些文件夹,所以全部清理)) - 尝试打开组成解决方案的每个项目 1-by-1 并构建它,以了解哪个是产生问题的特定项目
- 了解触发错误的更改/编辑/修改是什么,并撤消它(源代码控制工具可以帮助...)
- 如果您有自定义控件:检查构造函数中的代码。即使在设计时,VS IDE 也会调用自定义控件的构造函数,并且可能会发生奇怪的事情(在设计时某些属性不起作用,您的连接字符串可能没有填充......)
As a last resort...
作为最后的手段...
- Try to install any VS update
- Try to disable VS extensions (if you installed any...)
- Try to update any external DLL/Control referenced in your solution
- Try to update Windows
- 尝试安装任何 VS 更新
- 尝试禁用 VS 扩展(如果您安装了任何...)
- 尝试更新解决方案中引用的任何外部 DLL/控件
- 尝试更新 Windows
回答by Tom Stickel
Sometimes it is just a matter of closing Visual Studio 2015and then open again.
有时,它仅仅是一个事关的Visual Studio 2015和然后再次打开。
Update: Visual Studio 2017 apparently as well.
更新:Visual Studio 2017 显然也是如此。
I have had this happen on a few machines.
我在几台机器上发生过这种情况。
This does happen.
这确实会发生。
"Have you tried to delete the "Your_Solution_FileName.suo" file?"
“您是否尝试删除“Your_Solution_FileName.suo”文件?”
Also computer crashing like e.g. power outage etc...
还有计算机崩溃,例如停电等......
Applies to Update 2and Update 3as well as fresh base without any updates...
适用于更新 2和更新 3以及没有任何更新的新基础...
回答by Niels Filter
VS 2015-> Deletingall the files in the ComponentModelCacheworked for me:
VS 2015->删除ComponentModelCache对我有用的所有文件:
C:\Users\**username**\AppData\Local\Microsoft\VisualStudio\14.0\ComponentModelCache
C:\Users\**username**\AppData\Local\Microsoft\VisualStudio\14.0\ComponentModelCache
回答by QAZZY
I ran into this same problem but deleting the .suo file did not help. The only way I could get the project to load was by deleting the "Your_Project_FileName.csproj.user"file.
我遇到了同样的问题,但删除 .suo 文件没有帮助。我可以让项目加载的唯一方法是删除“Your_Project_FileName.csproj.user”文件。
--
——
I ran into this problem again a few months later but this time deleting the "Your_Project_FileName.csproj.user"file didn't help like it did last time. I finally managed to track it down to an IIS Express issue. I removed the site from my applicationhost.config and let Visual Studio recreate it, this allowed the project to finally be loaded.
几个月后我再次遇到这个问题,但这次删除“Your_Project_FileName.csproj.user”文件并没有像上次那样有帮助。我终于设法将其追溯到 IIS Express 问题。我从我的 applicationhost.config 中删除了该站点,并让 Visual Studio 重新创建它,这允许最终加载项目。
回答by Scott Munro
For me, this issue was being caused by conflicting <site>configurations in the following file.
对我来说,这个问题是由<site>以下文件中的配置冲突引起的。
C:\Users\smunro\Documents\IISExpress\config\applicationhost.config
I edited this file to remove all of the siteelements within the following element. You might want to be a little more selective and try to identify the site that is causing the conflict and remove just that.
我编辑了此文件以删除site以下元素中的所有元素。您可能希望更有选择性,并尝试确定导致冲突的站点并仅将其删除。
<configuration><system.applicationHost><sites>
Note that I left the <siteDefaults>, <applicationDefaults>and <virtualDirectoryDefaults>elements there.
请注意,我将<siteDefaults>,<applicationDefaults>和<virtualDirectoryDefaults>元素留在那里。
When I reloaded the project, a new <site>element was created automatically.
当我重新加载项目时,会<site>自动创建一个新元素。
回答by HiredMind
Make sure your Output Window is visible before hitting the F5 button. If you have your Output Window maximized, occasionally Visual Studio does not re-open the Output Window when you restart it.
在点击 F5 按钮之前,确保您的输出窗口可见。如果您将输出窗口最大化,Visual Studio 在您重新启动时偶尔不会重新打开输出窗口。
Simple fix: 1. Restart Visual Studio 2. BEFORE building a project, use View->Output Window
简单修复: 1. 重新启动 Visual Studio 2. 在构建项目之前,使用 View->Output Window
Now when you build, it should work.
现在当你构建时,它应该可以工作。
(I'm pretty sure deleting .suo and .user files only works because it resets Visual Studio to its default layout, which ensures the Output Window is visible.)
(我很确定删除 .suo 和 .user 文件只会起作用,因为它将 Visual Studio 重置为其默认布局,从而确保输出窗口可见。)
回答by munnster79
Run eventvwr from the command line to see if it has recorded any Application errors.
从命令行运行 eventvwr 以查看它是否记录了任何应用程序错误。
This might give you an actual error message that is more useful.
这可能会为您提供更有用的实际错误消息。
回答by Emmanuel
I had to remove a webproject. There was an old referencing DLL file inside, and I had to clean that webproject, and then it worked.
我不得不删除一个网络项目。里面有一个旧的引用 DLL 文件,我不得不清理那个 web 项目,然后它就可以工作了。
回答by Stefano Nepa
I had a similar problem on opening Razor Views
我在打开 Razor Views 时遇到了类似的问题
- I logged on to my Azure account which was asking to re-enter my credntials.
- Restart VS 2015 Update 1
- 我登录到我的 Azure 帐户,该帐户要求重新输入我的凭据。
- 重新启动 VS 2015 更新 1
回答by Elnaz
I had same error. I couldn't open any class and component of my solution. I deleted the ComponentModelCache and tested any other solutions.. but no result. Finally it helped me: Just CLOSE YOUR VISUAL STUDIO AND AGAIN OPEN IT!
我有同样的错误。我无法打开我的解决方案的任何类和组件。我删除了 ComponentModelCache 并测试了任何其他解决方案......但没有结果。最后它帮助了我:只需关闭您的视觉工作室并再次打开它!

