all groups > visual studio .net general > march 2004 >
You're in the

visual studio .net general

group:

Deploying assembly for COM interop


Re: Deploying assembly for COM interop Phil Wilson
3/31/2004 11:52:07 AM
visual studio .net general: It looks like you're doing the right thing with the setup project. How do you
know it's not registered properly? Can you see incorrect registry entries? Are
you getting an HRESULT you can report?
--
Phil Wilson [MVP Windows Installer]
----
[quoted text, click to view]

Deploying assembly for COM interop David-L. Nadeau
3/31/2004 1:40:09 PM
Hi!

I have build a setup project in VS 2003. I've setup my project to register
my assembly for COM. Interop. In my setup project I set register to
vsdrpCOM. Unfortunately, when i deploy my application the dll is not
register correctly in the registry. I have to regsiter it manually by doing
regasm "MyDll.dll" /codebase in order to make it visible as a COM object.

What am I doing wrong ?

How can I register and unregister my assembly as a COM object automaticly at
deployment ?

Thanks,

David

Re: Deploying assembly for COM interop David-L. Nadeau
3/31/2004 3:39:52 PM
I know it is not register properly for two reasons:

1) If i go to DOS and I do Regasm "MyDll" -u the unregistration fail (Subkey
does not exist).

2) I know that the registration failed at setup because my assembly is used
by a GIS software called ArcMap. When I register my assembly with regasm
/codebase I can execute my functions in the GIS. If I simply run the Setup
program the functions are not available.

I may have found something. When I go to the DOS prompt to call Regasm
/codebase the registration succeed, my functions runs in the GIS and they
works fine. But, I build an exe to register my dll automatically (see code
below) and the registration failed. The error is "File or assembly name
ADependentDLL, or one of its dependencies, was not found." I don't know why
I get this error because like I said it works with Regasm ?

So, probably my setup doesn't register my dll correctly because of the same
error and no errors are returned ? Why do I get this error with
System.Runtime.InteropServices.RegistrationServices and not Regasm.exe ???

Try

Path As String = "C:\Program Files\MyApp\Inventaire.dll" 'This path is
ok 100% sure.
Dim InstallingAssembly As System.Reflection.Assembly

InstallingAssembly = System.Reflection.Assembly.LoadFile(Path) 'This
line runs ok i put a msgbox that returns the Fullname of the assembly.

Dim Outil As New System.Runtime.InteropServices.RegistrationServices

Outil.RegisterAssembly(InstallingAssembly,
Runtime.InteropServices.AssemblyRegistrationFlags.SetCodeBase) 'This line
failed.

Catch

MsgBox(Err.Description)

End Try

Thanks,

David


"Phil Wilson" <phil.wilson@unisys.spamcom> a écrit dans le message de
news:%2395Anm1FEHA.3324@TK2MSFTNGP09.phx.gbl...
[quoted text, click to view]

Re: Deploying assembly for COM interop davguy NO[at]SPAM online.microsoft.com
4/1/2004 8:30:34 PM
There is a known bug (in both VS 2002 and VS 2003) where Regasm fails to
register properly if you are trying to register an assembly and the
dependency can't be found.

If you run RegAsm in the bin dir, usually the dependencies are copied
locally.

However, setup projects run regasm from the obj dir (for other important
reasons), where the dependency is not available. In this case, setup
projects will fail to register correctly.

The workaround is to add the assembly to your project as a "file", right
click in the File System Editor, and select Add File, and navigate to the
assembly in the bin dir. Usually that gets regasm to work and we get the
proper registration information.


---
David Guyer - VBQA Deployment Testing
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
[quoted text, click to view]
cpmsftngxa06.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP12
.phx.gbl
[quoted text, click to view]
Re: Deploying assembly for COM interop Antonio
10/14/2004 10:38:25 AM
It works!!!
I was having the same problem.

Thanks
Antonio

---
Posted using Wimdows.net NntpNews Component -

AddThis Social Bookmark Button