Question

I'm not a COM Interop expert so I haven't been able to figure out the last step to deploy my application. Few pieces of information

Using : VS 2010 C# and MS Access 2010 VBA Developing on: Windows 7 64 bit Target Env: Windows XP 32 bit

I've written an DLL that is called by the VB in Access to perform some Web API work. The DLL that gets built has the Make COM Visible check box checked. I then run the command

Regasm /register /codebase /tlb

to register the dll. After that I opened Access and added a reference to the dll. At this point the dll was still in the bin/debug directory after being built. Some more development work and a regasm /unregister followed by regasm /register of the new DLL and everything work working great. I'm now done with my development work and working on an installer for the DLL. I've created an installer that install the DLL at C:\Program files.... and then registers the DLL at that location using the same command. but When I open up Access to change the reference the old one is still there. Its pointing to bin/debug. I uncheck (remove the referance) close and save the Access. Opened the project back up and still the old reference was there. I used Browse button to browse to the tlb file at the new location, and I get the error User-defined type not defined. I went to the directory and manually ran the regasm command again. but still nothing. I would greatly appreciate any help on what steps I need to take to get this working.

Update 1 after continuing to play with it I think the problem is with what Visual studio is doing to make the DLL COM Visible. My next plan is to look into what Make DLL COM Visible actually does how to undo it and if I need to reproduce that on the installing machine.

Update 2 On further inspection I have found both the old entries and new entries for the COM Interop dll in the registry. I think the problem is I need to have the old entries removed. Will continue to look into it.

Update 3 using OLE object viewer I see that there are two entries one is for win32 and the other is for win64. win32 is pointing to C:\Program Files and Win64 is pointing to Bin\Debug. I think the problem is I need to install 64 bit version (I guess I have Office 64 bit). But I will need 32 bit for the target Env.

Was it helpful?

Solution

So it seems the basic problem was that my installed Access is 64 bit, and my installer was registering the DLL for 32 bit, and my dev Env was registering the dll for 64 bit. I rebuilt the installer to be 64 bit but when I checked OLE Object viewer the 64 bit path was still pointing to my dev path. I then used this information to manually run regasm again. Looked in OLE Object viewer and Path for 64 bit was now correctly pointing to C:\Progarm Files.

Final test opened Access and it worked.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top