0

I am looking to upgrade legacy VB6 COM+ components to VB.NET components. I have seemingly upgraded one already, called EventPackage, which has one class, IEventListener. Another, TradeOrders, Implements EventPackage.IEventListener. When attempting to build TradeOrders, I get the following Errors/Warnings;

  1. Cannot load type library for reference "EventPackage". Library not registered. (Exception from HRESULT: 0x8002801D (TYPE_E_LIBNOTREGISTERED))
  2. The referenced component 'EventPackage' could not be found.
  3. Type 'EventPackage.IEventListener' is not defined.

In the .vbproj, I notice this reference

<COMReference Include="EventPackage">
  <Guid>{0D76C094-21A6-4E04-802B-6E539F7102D7}</Guid>
  <Lcid>0</Lcid>
  <VersionMajor>2</VersionMajor>
  <VersionMinor>0</VersionMinor>
  <WrapperTool>tlbimp</WrapperTool>
</COMReference>

When I search the registry for this Guid, I find nothing. When using GUIDs for similar COM+ objects, I find them in HKEY_CLASSES_ROOT\CLSID\{...}\TypeLib ("..." being the GUID of the other component). When I go to the registry key name corresponding to EventPackage.IEventListener, I find that there is no \TypeLib subkey. As you might suspect, searching the reg for "0D76C094-21A6-4E04-802B-6E539F7102D7" yields no results.

So I know this must be a registry problem, But I have tried seemingly every google result I have found. I have tried Regasm and regsvcs .exe's to no avail. Many pages just tell me that dragging the dll to the COM+ manager should automatically register the component.

So how do I register the Type library?

Details on how I made EventPackage COM+ component

  1. Ran the VB6->VB.NET wizard

Then I added some lines to the assemblyinfo.vb file

  1. added Imports System.EnterpriseServices
  2. added Imports System.EnterpriseServices
  3. Imports System.Data.SqlClient
  4. <Assembly: CLSCompliant(True)>
  5. <Assembly: AssemblyKeyFileAttribute("...")> for a strong name
  6. <Assembly: Guid("...")> (Where "..." is the COM+ CLSID of the old component)

I added the following to the class file IEventListener.VB

  1. Imports System.EnterpriseServices
  2. <ComClass("...")> _ (Where ... is the proper COM+ CLSID, that is the only argument)
  3. Inherits ServicedComponent
  4. changed the ID made by the Conversion wizard to the proper value (from <System.Runtime.InteropServices.ProgId("IEventListener_NET.IEventListener)> to <System.Runtime.InteropServices.ProgId("EventPackage.IEventListener")> _

Then I dragged the DLL into the COM+ manager in the proper COM+ application (although, the "Path" is not specified and only says mscoree.dll)

k_Dank
  • 685
  • 1
  • 7
  • 17

3 Answers3

0

I had that dam error (0x8002801D (TYPE_E_LIBNOTREGISTERED)) yesterday, it drove me crazy: VSTO Add-ins, COMAddIns and RequestComAddInAutomationService

It might be a red-herring but my answer has similar details about reg keys not existing and etc:

Right click on Visual Studio (2010) > Run As Administrator > Open Project > Compile!

Community
  • 1
  • 1
Jeremy Thompson
  • 61,933
  • 36
  • 195
  • 321
  • I am using Windows XP, Visual Studio 2008. Running as administrator. I have "Register for COMInterop" Checked. – k_Dank Jun 06 '12 at 14:16
0

The console command "regsvr32 mydll.dll" will register your COM component. You should be able then to find the guid under HKEY_CLASSES_ROOT\CLASSID then, under which the InprocServer32 folder will have the path to your dll. This is how COM looks up the dll.

BobRodes
  • 5,990
  • 2
  • 24
  • 26
  • I am getting the error `EventPAckage.dll was loaded, but the DllRegisterServer entry point was not found. THis file can not e registered`. I am looking thru other StackOverflow questions to resolve this. – k_Dank Jun 07 '12 at 20:09
0

I think that the problem here is that you haven't generated a type library for your .NET component. I know you said you used regasm - but did you use the right command line?

  • Start Menu => Programs => Microsoft .NET Framework SDK vX.Y => SDK Command Prompt.
  • In this command line line, type: regasm /tlb:Mydll.dll
Mark Bertenshaw
  • 5,594
  • 2
  • 27
  • 40
  • So, when I first I got an error saying "Error RA0000 : No input file has been specified. Then I tried `regasm EventPackage.dll /tlb:EventPackage.dll`. This gave me the error `error RA0000 : An error occurred while saving the exported type library: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))`. I have tried deleting the old tlb, stopping iis, closing all dev/ie/iis tools but the error persists – k_Dank Jun 07 '12 at 19:43