项目无法打开时,Visual Studio崩溃 [英] project can't be opened, visual studio crashing

查看:621
本文介绍了项目无法打开时,Visual Studio崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最后一件事我所做的就是在更新表颜色的用户控件添加一个计时器。现在,每当我打开该项目时,它加载它,然后说:Visual Studio中停止工作。



我注意到,Visual Studio的奔跑,而在设计模式了,所以我认为这可能是造成问题的定时器,所以我从designer.cs删除计时器和更名的所有文件的Visual Studio是开放,但它仍然崩溃。所有其他项目的正常工作。这是它发生在我身上的第四次。我使用Visual Studio 2012旗舰版。有什么建议吗?


解决方案

这听起来像时坠毁工作室您的解决方案设置已损坏。您可以通过删除您的解决方案的 *锁文件重新设置:




  1. 确保您可以查看隐藏文件

  2. 查找Windows资源管理器解决方案。这应该是一个 *。SLN 文件

  3. 应该有一个隐藏的 *。锁在同一个文件夹中的文件。删除它。



这将重置所有的特定解决方案的设置,包括您打开的窗口。



在未来,你可以使用的如果防止代码从设计师执行: //msdn.microsoft.com/en-us/library/system.componentmodel.component.designmode.aspx> Form.DesignMode 属性(继承自 System.ComponentModel.Component ):

 如果(!this.DesignMode)

/ *把代码从设计者这里* /
排除} $ p>

Last thing I did was add a timer in a user control which updates form color. Now every time I open the project, it loads it up and then says 'Visual Studio Stopped Working'.

I noticed that Visual Studio 'runs' the timer while in designer mode too, so I thought that might be causing the problem so I removed the timer from designer.cs and then renamed all the files Visual Studio was opening, but still it crashes. All the other projects work fine. This is the 4th time that it has happened to me. I'm using Visual Studio 2012 Ultimate. Any suggestions please?

解决方案

It sounds like your solution settings were corrupted when Studio crashed. You can reset them by deleting your solution's *.suo file:

  1. Make sure you can view hidden files
  2. Find your solution in Windows Explorer. It should be a *.sln file
  3. 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 */
}

这篇关于项目无法打开时,Visual Studio崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆