Skip to content

How to correctly reference ADODB.Recordset type library to resolve "could not find the type library" warning? #392

@mitaken

Description

@mitaken

First of all, thank you for providing this great tool.

I have a C# class that creates an ADODB.Recordset and returns it to a COM client. When I build the project, dscom outputs a warning stating that it cannot find the type library for ADODB.Recordset (Warning TX0013116F).

I attempted to resolve this by specifying the type library path using in my .csproj file, but the warning persists.

Could you please guide me on how to correctly reference/embed the ADODB.Recordset type library?

My Environment:

  • Target Framework: .NET 10.0 (Windows only)
  • ADO Reference: C:\Program Files\Common Files\System\ado\msado15.dll

TestRecordset.csproj

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>net10.0-windows</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
    
    <EnableComHosting>true</EnableComHosting>
    <EnableRegFreeCom>true</EnableRegFreeCom>
    <DsComToolVerbose>true</DsComToolVerbose>
    <DsComTypeLibraryEmbedAfterBuild>true</DsComTypeLibraryEmbedAfterBuild>
  </PropertyGroup>

  <ItemGroup>
    <COMReference Include="ADODB">
      <WrapperTool>tlbimp</WrapperTool>
      <VersionMinor>1</VersionMinor>
      <VersionMajor>6</VersionMajor>
      <Guid>b691e011-1797-432e-907a-4d8c69339129</Guid>
      <Lcid>0</Lcid>
      <Isolated>false</Isolated>
      <EmbedInteropTypes>true</EmbedInteropTypes>
    </COMReference>
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="dSPACE.Runtime.InteropServices.BuildTasks" Version="2.4.3">
      <PrivateAssets>all</PrivateAssets>
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
    </PackageReference>
    <DsComTlbExportTlbReferences Include="C:\Program Files\Common Files\System\ado\msado15.dll" />
  </ItemGroup>

</Project>

TestRecordset.cs

using ADODB;
using System.Runtime.InteropServices;

namespace TestRecordset
{
    [ComVisible(true)]
    [Guid("7DC55C3B-9A08-4D1D-8022-4578D5C31B44")]
    [InterfaceType(ComInterfaceType.InterfaceIsDual)]
    public interface IRecordsetTlbTest
    {
        [DispId(1)]
        Recordset CreateRecordset();
    }

    [ComVisible(true)]
    [Guid("51B0DAB5-9539-43C4-AA13-F52E346B1539")]
    [ClassInterface(ClassInterfaceType.None)]
    [ProgId("TestRecordset.RecordsetTlbTest")]
    public class RecordsetTlbTest : IRecordsetTlbTest
    {
        public Recordset CreateRecordset()
        {
            return new Recordset();
        }
    }
}

Build log

1>  TestRecordset -> C:\Git\TestRecordset\TestRecordset\bin\Debug\net10.0\TestRecordset.dll
1>  Calling dscom.exe to export type library
1>  Interface 'IRecordsetTlbTest' exported.
1>dscom : warning TX0013116F: Warning: Type library exporter could not find the type library for ADODB.Recordset while writing member TestRecordset.IRecordsetTlbTest.CreateRecordset. IUnknown was substituted for the interface.
1>  Class 'RecordsetTlbTest' exported.
1>  Embedding type library 'C:\Git\TestRecordset\TestRecordset\bin\Debug\net10.0\\TestRecordset.tlb' into assembly 'C:\Git\TestRecordset\TestRecordset\obj\Debug\net10.0\TestRecordset.comhost.dll'...
1>  Calling dscom.exe to embed type library into assembly

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions