Problem. Windows Forms Designer does not work for an inherited user control when the base class implements an interface from another assembly.
Platform: VS 2010 SP1, .NET 4.0 Framework
Error:
A designer cannot be shown for this file, because none of the classes inside it can be designed. The designer examined the following classes in the file: MyControl --- The base class "MyBaseControlLib.MyBaseControl" may not load. Make sure that the assembly has been indicated and that all projects have been built.
in the System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.EnsureDocument (IDesignerSerializationManager manager) System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.PerformLoad (IDesignerMenerleMenialDesignerManagerMesser .VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.DeferredLoadHandler.Microsoft.VisualStudio.TextManager.Interop.IVsTextBufferDataEvents.OnLoadCompleted (Int32 fReload)
I have a solution with 3 library class projects:
MyInterfaceLib:
namespace MyInterfaceLib { public interface IMyInterface { void Foo(); } }
MyBaseControlLib:
namespace MyBaseControlLib { using System.Windows.Forms; using MyInterfaceLib; public partial class MyBaseControl : UserControl, IMyInterface { public MyBaseControl() { InitializeComponent(); } public void Foo() { } } }
MyDerivedLib:
namespace MyDerivedControlLib { using MyBaseControlLib; public partial class MyControl : MyBaseControl { public MyControl() { InitializeComponent(); } } }
Although the designer works for MyBaseControl, he does not work for MyControl. If MyBaseControl does not implement IMyInterface, the designer also works for MyControl.
Any ideas?
Thanks Robert
visual-studio-2010 winforms designer
Robert Hahn
source share