设计师无法显示此文件,因为没有在其内的类可以被设计 [英] The designer could not be shown for this file because none of the classes within it can be designed
问题描述
我们有以下共享组件:
public class OurServiceBase : System.ServiceProcess.ServiceBase
本类有我们希望在我们的所有下游业务,如标准化的执行调度和日志记录功能功能。
This class has functionality we want in all our downstream services, such as standardized execution scheduling and logging functionality.
在一个新的项目,我添加以下内容:
In a new project, I add the following:
public class MyService : System.ServiceProcess.ServiceBase
在Windows的设计,类显示正常。
In the Windows Designer, the class shows properly.
当我更改服务从OurServiceBase派生
When I change the service to derive from OurServiceBase
public class MyService : OurSharedLibrary.OurServiceBase
设计者停止工作:
完整的错误是:
设计者不能显示此文件,因为没有在其内的类可以被设计。设计者检查下列类文件中:EmailProcessor ---基类的OurSharedLibrary.CienaServiceBase无法加载。确保装配时已被引用,并且所有项目已建成。
The full error is: 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: EmailProcessor --- The base class 'OurSharedLibrary.CienaServiceBase' could not be loaded. Ensure the assembly has been referenced and that all projects have been built.
适当的组件引用,生成项目。我不明白为什么,因为我的服务最终也从可设计类派生的设计师翻转出过这一点。
The proper assemblies are referenced, the project builds. I don't understand why the designer is flipping out over this since my service ultimately does derive from a designable class.
任何建议将是最欢迎的。
Any suggestions would be most welcome.
位的详细信息 - 从当它呈现有关无法设计出衍生服务错误的设计者调用堆栈:
Bit more information - the call stack from the designer when it renders the error about not being able to design the derived service:
at System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.EnsureDocument(IDesignerSerializationManager manager)
at System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager manager)
at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager serializationManager)
at System.ComponentModel.Design.Serialization.BasicDesignerLoader.BeginLoad(IDesignerLoaderHost host)
2011/7/19下午2时34 EDT新发现。
7/19/2011 2:34PM EDT New discovery.
班OurServiceBase存在于一个单独的项目(通常为DLL只引用)。一时兴起,我复制了基础类文件到我的项目,建成,并开通了设计师。有效!当我再次删除基类文件,并返回给外部DLL参考,设计师再次爆发。
Class "OurServiceBase" exists in a separate project (usually referenced as a DLL only). On a whim, I copied the base class file into my project, built, and opened the designer. It worked! When I removed the base class file again and returned to the external DLL reference, the designer broke again.
推荐答案
您最好的选择将是开始使用版本 OurServiceBase
的无功能的,看看你是否可以设计为MyService
。如果是这样,那么,直到它打破慢慢加回功能。
Your best bet would be to start with a version of OurServiceBase
with no functionality and see if you can design MyService
. If so, then slowly add back functionality until it breaks.
,因为它看起来像Visual Studio是有序列 OurServiceBase的成员之一的一个问题
。
Since it looks like Visual Studio is having a problem serializing one of the members of OurServiceBase
.
这篇关于设计师无法显示此文件,因为没有在其内的类可以被设计的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!