0
votes

I am working with some test code to create Visio documents. I am using Visual Studio 2010 on Window 7 64 bit. When I run my program and attempt to create the new Visio application object in the program I get thie following exception:

Retrieving the COM class factory for component with CLSID {00021A20-0000-0000-C000-000000000046} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).

Here's the code that causes the exception:

Visio.Application va = new Microsoft.Office.Interop.Visio.Application();

I verified the project settings are to build a 32-bit application. I have tracked it back to 64-bit Windows can't load the 32-bit .COM Visio dll. I tried registering the dll using regsvr32 but get an error message that the entry-point DLLregisterserver was not found. MDSN says this means the file is not a valid .dll. Nowever I am trying to register the Microsoft.Office.Interop.Visio.dll from the Visual Studio libraries. Is there a fix for this? Is there a 64-bit version of the .COM libraries?

2
Which version of .net you are using?Dinesh
Are you using 32-bit or 64-bit Office? That's what matters, not the bitness of Windows.Ben Voigt
I am using .NET 4.0. I already checked the project settings, I am building for 32-bit. FWIW the same project I have some test code that builds an Excel spreadsheet. That is also .COM and I assume is also 32-bit.David Green
@David: I'm pretty sure you're going to need to install 32-bit Visio in order to use its Interop assembly from a 32-bit program.Ben Voigt

2 Answers

0
votes

Follow this link. This page explains how to install dlls as on 32 bit system, though you are using 64 bit system

You can find 32-bit version of REGSVR32 on 64 bit system on path-- %systemroot%\SysWoW64\regsvr32.exe.

WoW = stands for Windows on Windows

0
votes

The Interop assembly you're trying to load depends on the native Visio DLLs. In order to load those DLLs in-process, they need to match your process bitness.

So, you'll need to have 32-bit Visio installed.