如何解决VS2010 Windows窗体设计器问题(基类无法加载)窗体、如何解决、加载、问题

由网友(水月轩颠峰)分享简介:我最近一直在用继承的用户控件时,得到的VS2010SP1的Windows窗体设计错误。I have recently been getting an error in the Windows Forms designer of VS2010SP1 when using inherited UserControls....

我最近一直在用继承的用户控件时,得到的VS2010SP1的Windows窗体设计错误。

I have recently been getting an error in the Windows Forms designer of VS2010SP1 when using inherited UserControls.

该错误是

设计者无法显示此文件,因为没有任何的   在其内的类能够被设计。设计师视察   下列类文件中:DebugPanel ---基类   UI.Panels.PanelBase无法加载。保证   装配已被引用,并且所有项目已建成。

The designer could not be shown for this file because none of the classes within it can be designed. The designer inspected the following classes in the file: DebugPanel --- The base class 'UI.Panels.PanelBase' could not be loaded. Ensure the assembly has been referenced and that all projects have been built.

PanelBase]是在同一类库DebugPanel也实现接口茁壮(后者又在同一类库中定义)中定义一个用户控件。 茁壮实现了在不同的类库中定义的接口IBaseItem

PanelBase is a UserControl that is defined in the same class library as DebugPanel that also implements an interface IPanel (which is in turn defined in the same class library). IPanel implements an interface IBaseItem that is defined in a different class library.

因此​​,我们有

DebugPanel            (Library UI.Shared2)
- PanelBase           (Library UI.Shared2)
    - UserControl     (System.Windows.Forms - .NET4)
    - IPanel          (Library UI.Shared2)
        - IBaseItem   (Library Net.Common) 

PanelBase是可设计正确,该项目的所有构建正确的作品,但是当我尝试和设计任何继承控制设计失败。这不仅限于DebugPanel控制,但任何控制从PanelBase继承......我也看到了问题,我使用的是有类似的继承层次结构等控制。

PanelBase is designable correctly, the project all builds correctly and works but when I try and design any inherited control the designer fails. This is not limited to the DebugPanel control, but any control inheriting from PanelBase... I've also seen the issue with other controls that I use that have similar inheritance hierarchies.

予一般可以暂时通过清洗库UI.Shared2,关闭VS和然后再次打开它,重建溶液和打开设计解决该问题。 然后,这将工作一小会儿,然后开始再次失败。

I can generally resolve the problem temporarily by cleaning the library UI.Shared2, closing VS and then opening it again, rebuilding the solution and opening the designer. This will then work for a short while and then start to fail again.

有没有人有能解决这个问题有什么建议永久而不是诉诸重启VS?

Does anyone have any suggestions that can resolve this issue permanently without resorting to restarting VS?

编辑:我瞄准了完整版本的.NET 4的所有库

I am targeting the full version of .NET 4 with all libraries.

推荐答案

我建议把你的基类中的一个单独的项目。如你明明知道,问题是,VS是失去跟踪的一些元信息,你可以得到它的发现通过退出和重建。如果基类是在一个单独的项目,清洁/重建更有可能将其带回最新的。

I would suggest putting your base class in a separate project. As you obviously know, the problem is that VS is losing track of some meta information, which you can get it to find by quitting and rebuilding. If the base class is in a separate project, a clean/rebuild is more likely to bring it back up to date.

阅读全文

相关推荐

最新文章