MSBuild fails with "Cannot find wrapper assembly for type library ADODB"

Jonathan Smith 1 Reputation point
2022-01-11T16:18:15.447+00:00

I am trying to produce a Docker container capable of building our web app, which uses ADO 2.8.

Currently we are able to build the we app from the command line using MSBuild with no problems whatsoever.

Using the mcr.microsoft.com/dotnet/framework/sdk:4.8-20211012-windowsservercore-ltsc2019 base image we then install and register all required components.

If I then try to run MSBuild within the container the build fails with Cannot find wrapper assembly for type library ADODB.

In the container, if i run req query against the CLSID for v2.8 of ADODB i see the following:

HKEY_LOCAL_MACHINE\SOFTWARE\Classes\TypeLib\{2A75196C-D9EB-4129-B803-931327F72D5C}\2.8
    (Default)    REG_SZ    Microsoft ActiveX Data Objects 2.8 Library

HKEY_LOCAL_MACHINE\SOFTWARE\Classes\TypeLib\{2A75196C-D9EB-4129-B803-931327F72D5C}\2.8\0

HKEY_LOCAL_MACHINE\SOFTWARE\Classes\TypeLib\{2A75196C-D9EB-4129-B803-931327F72D5C}\2.8\0\win32
    (Default)    REG_SZ    C:\Program Files (x86)\Common Files\System\ado\msado28.tlb

HKEY_LOCAL_MACHINE\SOFTWARE\Classes\TypeLib\{2A75196C-D9EB-4129-B803-931327F72D5C}\2.8\0\win64
    (Default)    REG_SZ    C:\Program Files\Common Files\System\ado\msado28.tlb

HKEY_LOCAL_MACHINE\SOFTWARE\Classes\TypeLib\{2A75196C-D9EB-4129-B803-931327F72D5C}\2.8\FLAGS
    (Default)    REG_SZ    0

If I run the same reg query command on my development PC I get the following:

HKEY_CLASSES_ROOT\TypeLib\{2A75196C-D9EB-4129-B803-931327F72D5C}\2.8
    (Default)    REG_SZ    Microsoft ActiveX Data Objects 2.8 Library
    PrimaryInteropAssemblyName    REG_SZ    ADODB, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a

HKEY_CLASSES_ROOT\TypeLib\{2A75196C-D9EB-4129-B803-931327F72D5C}\2.8\0

HKEY_CLASSES_ROOT\TypeLib\{2A75196C-D9EB-4129-B803-931327F72D5C}\2.8\0\win32
    (Default)    REG_SZ    C:\Program Files (x86)\Common Files\System\ado\msado28.tlb

HKEY_CLASSES_ROOT\TypeLib\{2A75196C-D9EB-4129-B803-931327F72D5C}\2.8\0\win64
    (Default)    REG_SZ    C:\Program Files\Common Files\System\ado\msado28.tlb

HKEY_CLASSES_ROOT\TypeLib\{2A75196C-D9EB-4129-B803-931327F72D5C}\2.8\FLAGS
    (Default)    REG_SZ    0

As you can see my development PC has the PrimaryInteropAssemblyName property.

I have tried copying the version of ADODB.dll from my machine to the container and adding it to the GAC using gacutil but that added the PrimaryInteropAssemblyName to v2.7 of the ADO registry entry.

As a complete hatchet-job, if I manually add that string into the v2.8 registry entry in the docker container then MSBuild completes successfully.

What process is it that adds the PrimaryInteropAssemblyName to v2.8 of the ADO registry entry? Surely hacking it in via reg add isnt the right thing to do.

Community Center Not monitored
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.