简体   繁体   English

类型库导出程序遇到了从通用类派生的类型

[英]Type library exporter encountered a type that derives from a generic class

I want to call a WCF Service which is implemented as a generic class. 我想调用作为通用类实现的WCF服务。 Note: [I have completely no access to modify its classes either to marks it COM visible or to make it as non generic class etc]. 注意:[我完全无权修改其类以将其标记为COM可见或使其成为非通用类,等等]。

I have write a client which consumes that WCF Service. 我已经写了一个使用该WCF服务的客户端。 I get warning that: 我收到警告:

"Type library exporter warning processing 'WCFService.MultiService.LokUpServiceClient, WCFService'. Warning: Type library exporter encountered a type that derives from a generic class and is not marked as [ClassInterface(ClassInterfaceType.None)]. Class interfaces cannot be exposed for such types. Consider marking the type with [ClassInterface(ClassInterfaceType.None)] and exposing an explicit interface as the default interface to COM using the ComDefaultInterface attribute". “类型库导出程序警告处理'WCFService.MultiService.LokUpServiceClient,WCFService'。警告:类型库导出程序遇到了从通用类派生的类型,并且未标记为[ClassInterface(ClassInterfaceType.None)]。无法为考虑使用[ClassInterface(ClassInterfaceType.None)]标记类型,并使用ComDefaultInterface属性将显式接口公开为COM的默认接口。

Question: To make WCF client COM visible by consuming perfectly WCF Service? 问:通过完全使用WCF服务使WCF客户端COM可见?
How to get rid of this warning message? 如何摆脱这个警告信息?

At the moment of adding a service reference try deselecting the option of Reusing existing types. 在添加服务引用时,请尝试取消选择“重用现有类型”选项。

重用引用程序集中的类型

+1 to the accepted answer. +1接受的答案。 I just want to add that if you've already configured a service reference, you can change the Reuse types... setting for the service reference as follows: 我只想补充一下,如果您已经配置了服务引用,则可以如下更改服务引用的“重用类型...”设置:

  1. In the Solution Explorer, find the service reference. 在解决方案资源管理器中,找到服务参考。 It should appear under a Connected Services or Web Services section. 它应显示在“ 连接的服务”或“ Web服务”部分下。
  2. Right-click the service reference and click Configure Service Reference . 右键单击服务引用,然后单击配置服务引用 A Settings dialog box appears. 出现设置对话框。
  3. Clear the Reuse types in referenced assemblies check box. 清除“ 在引用的程序集中复用类型”复选框。
  4. Click OK . 单击确定

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 警告:类型库导出程序遇到了从通用类派生的类型,未标记为[ClassInterface(ClassInterfaceType.None)] - Warning: Type library exporter encountered a type that derives from a generic class and is not marked as [ClassInterface(ClassInterfaceType.None)] 如何使用受约束的泛型类型参数将 class 实例化为派生接口 - How to instantiate a class as the interface that it derives from with constrained generic type parameter 如何测试Type是否从抽象基类泛型类型派生? - How to test if Type derives from an abstract base generic type? 检查类型是否派生自具有多个通用参数的接口 - Check if a Type derives from a Interface with more than one Generic Argument 获取从泛型类型派生的具体类型,而不管泛型类型参数如何 - Get concrete type that derives from generic type, regardless of the generic type parameter 出口工厂 - ExportFactory<T,TMetaData - Get type of class which derives from T 创建一个List实例,其类型派生自基类和接口 - Create an instance of a List where the type derives from a base class and an interface Unity3D EventManager:具有从接口派生的通用类型事件的字典 - Unity3D EventManager: Dictionary with Events of generic Type that derives from an interface 确定对象是否来自特定类型? - Determine if object is or derives from specific Type? 判断object是否派生自集合类型 - Determine if object derives from collection type
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM