警告:类型库导出器遇到一个派生自泛型 class 且未标记为 [ClassInterface(ClassInterfaceType.None)] 的类型

Warning: Type library exporter encountered a type that derives from a generic class and is not marked as [ClassInterface(ClassInterfaceType.None)]

我正在制作一个程序套件来连接到远程服务器并通过 WSDL 发送一些信息,这是成功的并且工作正常,但我被命令将我的所有程序移植到 DLL 中,我必须启用 COM 互操作和制作一些 returns,我的大部分程序都运行良好,直到我在我的一个程序中发现这个错误,该程序使用两个由 WSDL 制作的代理 类,我花了整整一周的时间阅读网络细节,但我不明白如何修复它,这是错误

Warning 1   Type library exporter warning processing 'Tarea.CrSeedService.CrSeedClient, Tarea'. 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. Tarea    

这是得到错误的代理 类 之一

http://pastebin.com/y1zFfzER 这是服务参考reference.cs文件

http://pastebin.com/vJuFZqsd

inb4 有些人报告此问题重复 我已阅读 Is it possible to implement a COM interface with a .NET generics class? 但还是没听懂

如果您看到我已经在代理 cs 文件的所有 类 定义中添加了以下

[ClassInterface(ClassInterfaceType.None)]
[ComSourceInterfaces(typeof(Procesos.Iclass1))]    

其中

  [ComVisible(true)]
    public interface  Iclass1
    {
    string Ejecucion(string cn, string speed);
    }

其中 assemblyinfo.cs

[assembly: ComVisible(true)]

我该怎么办? 我做错了什么?

我希望得到一些指导,VS2013 无法准确指导我哪里出错了 虽然它手动说它 "CrSeedService.CrSeedClient" 我已经添加了定义但仍然输出错误。

[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
[ClassInterface(ClassInterfaceType.None)]
[ComSourceInterfaces(typeof(Procesos.Iclass1))]
public partial class CrSeedClient :        System.ServiceModel.ClientBase<Tarea.CrSeedService.CrSeed>,   Tarea.CrSeedService.CrSeed
{
blah
}

此致

我在我的解决方案资源管理器中找不到文件 reference.cs,但我可以通过搜索功能进入它(搜索 "class CrSeedClient")

http://puu.sh/g3Yv8/3e8f11c975.png

所以我添加了缺失的行,现在它可以正常工作了。

[ClassInterface(ClassInterfaceType.None)]
[ComSourceInterfaces(typeof(Procesos.Iclass1))]
public partial class CrSeedClient

或者您可以编辑参考文件,手动查找文件

http://puu.sh/g3YzU/8523948580.png

也许是我的错,算作菜鸟错误,我不确定