views:

210

answers:

4

I'm trying to reference a COM dll in visual studio by using the Browse tab and selecting the DLL. I noticed that if the DLL is registered on the system with regsvr32 I can reference it, but if it's not registered I receive an error selecting the dll file "A reference to 'file.DLL' could not be added. Please make sure that the file is accessible, and that it is a valid assembly or COM component."
We would like to keep the DLL not registered, so that we have less configuration needed on other development machines and on the development environments.
Is it too much to ask?
Thanks!

+1  A: 

you need to register dll. you can set registration in your setup project or create a batch file for all these type of processes. Note: Don't forget to unregister dll on uninstallation.

Brij
A: 

You'll need to register the dll because otherwise it would not be able to find the type library.
Adding the dll afterwards as a reference to you project will create the interop.XXXXmethod.dll assembly.

Mez
A: 

You need to have the COM server registered, period. You could take some measures to automate the process though and to unregister the COM server when it is not needed.

The same applies to daily builds. If you build a COM server and a .NET based client during the build you have to register the server prior to building the client. And you better unregister it as soon as the client is built. Adding these steps to the build sequence is not a problem at all.

sharptooth
A: 

You might be able to use Registration Free Com

Sam Holder