project can't be opened, visual studio crashing
It sounds like your solution settings were corrupted when Studio crashed. You can reset them by deleting your solution's *.suo
file:
- Make sure you can view hidden files
- Find your solution in Windows Explorer. It should be a
*.sln
file - There should be a hidden
*.suo
file in the same folder. Delete it.
That will reset all of your solution-specific settings, including the windows you had open.
In the future, you can prevent code from executing in the designer by wrapping it in an if
using the Form.DesignMode
property (inherited from System.ComponentModel.Component
):
if(!this.DesignMode)
{
/* put code to be excluded from the designer here */
}
UPDATE for VS 2017 and 2019
In VS 2017 and 2019, the *.suo
file has been moved into a .vs
folder within the solution directory:
~/[Solution Directory]/.vs/[Solution Name]/.suo
You can just delete the entire .vs
folder to reset your local settings for that solution.
Disabling Visual Studio extensions fixed it for me
Tools -> Extensions and Updates -> Installed
In my case, Web Essentials
was causing the problem
Hope this helps!
If you have a different version of Visual Studio on your computer open that one. Click Debug -> Attach To Process. Select the other Visual Studio process. You should only be able to see one. The Process name is devenv.exe.
Now replicate the problem in the broken VS. It will break on the exception in the unbroken VS.
In my case the exception looked like this
An unhandled exception of type 'System.TypeLoadException' occurred in Microsoft.VisualStudio.Platform.VSEditor.dll
Additional information: Method 'Connect' in type 'JetBrains.UI.SrcView.ContextNotifications.ContextNotificationControl' from assembly 'JetBrains.Platform.UI, Version=104.0.0.0, Culture=neutral, PublicKeyToken=1010a0d8d6380325' does not have an implementation.
I fixed it by running the Resharper installer and setting the repair option.