Lee Grissom
Lee Grissom

Reputation: 9953

VS 2012.3 Referencing MS Access COM DLL, could not resolve COM reference error

I created a new Console project in VS2012.3 (32bit exe) and added a COM Type Library reference to Microsoft Access (I tried both 2003 and 2007). The "Microsoft Access" reference shows up in the Add Reference dialog no problem. However, upon closing that dialog VS displays a yellow triangle overlay on the two newly added references, and I get the following build error:

Could not resolve COM reference "4affc9a0-5f99-101b-af4e-00aa003f0f07" version 9.0. Object reference not set to an instance of an object.

My colleagues are able to do this with no problem on their computer. So I'm trying to figure out what could be the problem with my machine. I'm running Windows 8.1, whereas others are running a mix of Windows 8.0 and 7. Any ideas?

Update - Some screen shots: MS Access in OLEView

Add Reference Dialog

VS COM References not found

ADODB Interop Assembly

ADODB GAC

MsADO25.tlb

Missing PrimaryInteropAssemblyName value in Registry

Upvotes: 9

Views: 5410

Answers (4)

Indigo
Indigo

Reputation: 853

For me, it was also after upgrade my machine from Windows 10 to 11, like the answer from Diego Montania. However, I didn't have any reference to Microsoft ActiveX.

Instead, I performed an Office Quick Repair :

"C:\Program Files\Common Files\microsoft shared\ClickToRun\OfficeClickToRun.exe" scenario=Repair RepairType=QuickRepair

Then, I deleted and re-added the reference in Visual Studio.

Now compilation works. Hope it helps!

Upvotes: 0

Diego Montania
Diego Montania

Reputation: 346

First after upgrade my machine from windows 10 to windows 11, the visual studio give me the same error from title of this post. I did the step from Lee Grissom's repply, and still not working.

So, I found a suggestion from the last current comment on this msdn post, from the user Bedford Bob, removing this reference Microsoft ActiveX Data Objects 2.8 Library from the project and building again, and works.

I don't no how, but after adding the reference again (just for test), the project now works, without any problems, lol.

Upvotes: 0

Lee Grissom
Lee Grissom

Reputation: 9953

Problem Solved: I found the solution here: http://support.microsoft.com/kb/823996.
All I had to do was open the "Developer Command Prompt for VS2012", navigate down to the GAC's ADODB folder, then run regasm.exe ADODB.dll. That fixed the entire problem.

At VS 2012 Command Prompt run regasm

Problem solved: VS COM References now found.

Upvotes: 20

noseratio
noseratio

Reputation: 61666

Windows 8.1 comes with the latest .NET 4.5.1 runtime. First, try installing .NET 3.5 (which includes .NET 2.0/3.0 and is not there by default). You can do that via Control Panel/Turn Windows Feartures on and off.

Further, the {4AFFC9A0-5F99-101B-AF4E-00AA003F0F07} GUID suggests you're using Office 2010. The corresponding type library should be found here:

C:\Program Files (x86)\Microsoft Office\Office14\MSACC.OLB

Try opening it with OleView and see if there's any error.

The next step would be check if the primary interop assembly (PIA) for Access, Microsoft.Office.Interop.Access.dll, has been correctly installed. It should be found under:

C:\Windows\assembly\GAC_MSIL\Microsoft.Office.Interop.Access\

Finally, you can try repairing your Office 2010 installation (which should re-register the type library), re-install Office 2010 PIAs, and finally install the latest VSTO Runtime (apparently, that link is still the latest for VS2013).

Upvotes: 1

Related Questions