none
failed to generate type library for EnterpriseLibrary RRS feed

  • Question

  • I have a custom .NET library assembly that uses COM+ and references Microsoft.Practices.EnterpriseLibrary.Data 5.0

    When I try to install it into COM+ I'm getting an error:

    PS C:\windows\Microsoft.NET\Framework64\v4.0.30319> .\RegSvcs.exe "***.dll"
    Microsoft (R) .NET Framework Services Installation Utility Version 4.0.30319.33440
    Copyright (C) Microsoft Corporation.  All rights reserved.

    Auto exporting 'Microsoft.Practices.EnterpriseLibrary.Data, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856a
    d364e35' as 'C:\Windows\assembly\GAC_MSIL\Microsoft.Practices.EnterpriseLibrary.Data\5.0.414.0__31bf3856ad364e35\Microso
    ft.Practices.EnterpriseLibrary.Data.tlb'.
    Type library exporter warning processing 'Microsoft.Practices.EnterpriseLibrary.Data.DataAccessor`1, Microsoft.Practices
    .EnterpriseLibrary.Data'. Warning: Type library exporter encountered a generic type. Generic classes may not be exposed
    to COM.
    Type library exporter warning processing 'Microsoft.Practices.EnterpriseLibrary.Data.CommandAccessor`1, Microsoft.Practi
    ces.EnterpriseLibrary.Data'. Warning: Type library exporter encountered a generic type. Generic classes may not be expos
    ed to COM.
    Type library exporter warning processing 'Microsoft.Practices.EnterpriseLibrary.Data.IResultSetMapper`1, Microsoft.Pract
    ices.EnterpriseLibrary.Data'. Warning: Type library exporter encountered a generic type. Generic classes may not be expo
    sed to COM.
    Type library exporter warning processing 'Microsoft.Practices.EnterpriseLibrary.Data.IRowMapper`1, Microsoft.Practices.E
    nterpriseLibrary.Data'. Warning: Type library exporter encountered a generic type. Generic classes may not be exposed to
     COM.
    Type library exporter warning processing 'Microsoft.Practices.EnterpriseLibrary.Data.MapBuilder`1, Microsoft.Practices.E
    nterpriseLibrary.Data'. Warning: Type library exporter encountered a generic type. Generic classes may not be exposed to
     COM.
    Type library exporter warning processing 'Microsoft.Practices.EnterpriseLibrary.Data.IMapBuilderContext`1, Microsoft.Pra
    ctices.EnterpriseLibrary.Data'. Warning: Type library exporter encountered a generic type. Generic classes may not be ex
    posed to COM.
    Type library exporter warning processing 'Microsoft.Practices.EnterpriseLibrary.Data.IMapBuilderContextTest`1, Microsoft
    .Practices.EnterpriseLibrary.Data'. Warning: Type library exporter encountered a generic type. Generic classes may not b
    e exposed to COM.
    Type library exporter warning processing 'Microsoft.Practices.EnterpriseLibrary.Data.IMapBuilderContextMap`2, Microsoft.
    Practices.EnterpriseLibrary.Data'. Warning: Type library exporter encountered a generic type. Generic classes may not be
     exposed to COM.
    Type library exporter warning processing 'Microsoft.Practices.EnterpriseLibrary.Data.ReflectionRowMapper`1, Microsoft.Pr
    actices.EnterpriseLibrary.Data'. Warning: Type library exporter encountered a generic type. Generic classes may not be e
    xposed to COM.
    Type library exporter warning processing 'Microsoft.Practices.EnterpriseLibrary.Data.SprocAccessor`1, Microsoft.Practice
    s.EnterpriseLibrary.Data'. Warning: Type library exporter encountered a generic type. Generic classes may not be exposed
     to COM.

    The following installation error occurred:
    1: Failed to generate type library '***' for '***'.
    2: Type library exporter encountered an error while processing '***'. Error: Failed to generate type library 'C:\Windows\assembly\GAC_MSIL\Microsoft.Practices.EnterpriseLibra
    ry.Data\5.0.414.0__31bf3856ad364e35\Microsoft.Practices.EnterpriseLibrary.Data.tlb' for 'Microsoft.Practices.EnterpriseL
    ibrary.Data, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.

    My custom library is targeting .NET 4.5.1

    Running on Windows 2012 Server R2

    Spend a couple of days on this, couldn't find anything useful. Please help out. Thank you.

    Tuesday, December 9, 2014 4:42 PM

Answers

  • It's quite likely then that you're accessing the same object type in the EnterpriseLibrary that library's underlying code has changed and now uses a generic.  The trick is going to be to figure out which class that is and change it's exposed type (e.g. to object and then use casting subsequently when you want to use it as the other type).


    WinSDK Support Team Blog: http://blogs.msdn.com/b/winsdk/

    • Marked as answer by ntraubenberg Thursday, December 18, 2014 7:15 PM
    Tuesday, December 9, 2014 6:21 PM
  • Let's say that you're accessing a class named Bob for argument's sake. Bob has eight members in version 2.0. In version 4, Bob added a new function that returned a generic result. Because you are using Bob, even though you aren't using the new function that return a generic type, the type library registration will now fail when used with version 4.  This would be the case if Bob was a member of a member of a member (infinitely recursible) of a type that you do use as well.

    WinSDK Support Team Blog: http://blogs.msdn.com/b/winsdk/


    Tuesday, December 9, 2014 6:52 PM

All replies

  • You need to make your generic classes and references to those classes not exposed to COM.

    WinSDK Support Team Blog: http://blogs.msdn.com/b/winsdk/

    Tuesday, December 9, 2014 5:11 PM
  • I don't have any generic classes, the enterprise library does.
    Tuesday, December 9, 2014 5:31 PM
  • What are you exporting from your library? Do any of those classes have references to the generic classes from the other dll? That is most likely the case.

    WinSDK Support Team Blog: http://blogs.msdn.com/b/winsdk/

    Tuesday, December 9, 2014 5:33 PM
  • Have one class that extends ServicedComponent, it does not reference EnterpriseLibrary. Have another class that implements Microsoft.Practices.EnterpriseLibrary.Data.IParameterMapper its marked as [Serializable] but it is not a COM+ component.
    Tuesday, December 9, 2014 5:44 PM
  • When I say class, I mean the class and all of its members, both inherited and explicit, fields, properties, methods, etc.  If the class is exposed, its entire dependency chain is exposed.  If your class that extends ServiceComponent isn't using something from EnterpriseLibrary at one of those levels, why even include it in the same dll?


    WinSDK Support Team Blog: http://blogs.msdn.com/b/winsdk/

    Tuesday, December 9, 2014 5:52 PM
  • Its a big class but I don't think it has any dependencies that reference enterprise lib.

    That's the way it was designed, I'm just maintaining it.

    Tuesday, December 9, 2014 6:06 PM
  • Also it does work on my Windows 7 workstation, no errors from Regsvcs.
    Tuesday, December 9, 2014 6:06 PM
  • Same version of .NET and both dlls?  The errors indicate that it thinks it needs to export Microsoft.Practices.EnterpriseLibrary.Data as well to make the tlb for your dll.

    WinSDK Support Team Blog: http://blogs.msdn.com/b/winsdk/

    Tuesday, December 9, 2014 6:09 PM
  • No actually, enterprise library is 2.0, mine is 4.0

    Tuesday, December 9, 2014 6:14 PM
  • It's quite likely then that you're accessing the same object type in the EnterpriseLibrary that library's underlying code has changed and now uses a generic.  The trick is going to be to figure out which class that is and change it's exposed type (e.g. to object and then use casting subsequently when you want to use it as the other type).


    WinSDK Support Team Blog: http://blogs.msdn.com/b/winsdk/

    • Marked as answer by ntraubenberg Thursday, December 18, 2014 7:15 PM
    Tuesday, December 9, 2014 6:21 PM
  • Sorry, don't understand your answer. I'm accessing same object type as what?
    Tuesday, December 9, 2014 6:37 PM
  • Let's say that you're accessing a class named Bob for argument's sake. Bob has eight members in version 2.0. In version 4, Bob added a new function that returned a generic result. Because you are using Bob, even though you aren't using the new function that return a generic type, the type library registration will now fail when used with version 4.  This would be the case if Bob was a member of a member of a member (infinitely recursible) of a type that you do use as well.

    WinSDK Support Team Blog: http://blogs.msdn.com/b/winsdk/


    Tuesday, December 9, 2014 6:52 PM
  • So basically here you are implying what you said before that my servicedcomponent class somehow somewhere has a dependency that references enterprise library.
    Tuesday, December 9, 2014 6:59 PM
  • Without a doubt, it does. The reason you'd be encountering it now if you haven't changed your code would be that something along the underlying path of whatever dependency is there has changed. Searching for the namespace in question amongst your source files may be an easy way to track it down.

    WinSDK Support Team Blog: http://blogs.msdn.com/b/winsdk/

    Tuesday, December 9, 2014 7:01 PM
  • Thank you very much for your time. Will do more research on that. Will post the resolution if I come up with it.
    Tuesday, December 9, 2014 7:16 PM
  • I fixed this by removing ServicedComponent dependency from the class that was causing this problem.
    Thursday, December 18, 2014 7:14 PM