I'm trying to generate a Primary Interop Assembly for one of my projects that references Microsoft ActiveX Data Objects (MDAC 2.8). Adding this library through the References dialog box in Visual Studio adds the Interop.ADOR.dll file to the bin d开发者_Go百科irectory of the solution.
However, when I run tlbimp.exe I get the error:
C:\Solution> tlbimp Component.dll /out: My.Interop.Component.dll /keyfile:myKeyFile
.snk /primary
Microsoft (R) .NET Framework Type Library to Assembly Converter 3.5.30729.1
Copyright (C) Microsoft Corporation. All rights reserved.
TlbImp : error TI0000 : System.ApplicationException - Referenced type library 'A
DOR' does not have a primary interop assembly registered.
I was unable to find anything online, which is odd. Any ideas?
Just drop the /primary argument for tlbimp.exe. There's little point in generate PIAs for your own components. Making members of your classes public that use an ADOR type is best avoided, you'll saddle the user of your component with having to have a reference to it as well and use the same ADOR PIA.
If you really want to do this then you'll have to generate a PIA for msador15.dll first and register it. I'm pretty sure that Microsoft doesn't ship one. You'll also have to deploy them.
精彩评论