Multimobile Development: Building Applications for any Smartphone
Deploying assembly for COM interop
Messages   Related Types
This message was discovered on microsoft.public.vsnet.general.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.

David-L. Nadeau
GOOD ANSWER
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

Reply to this message...
Vote that this is a GOOD answer... (1 vote from another user already)
 
 
    
Phil Wilson
GOOD ANSWER
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]
----
"David-L. Nadeau" <Click here to reveal e-mail address> wrote in message
news:eM1hY%Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
Vote that this is a GOOD answer... (3 votes from other users already)
 
 
    
David-L. Nadeau
GOOD ANSWER
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" <Click here to reveal e-mail address> a écrit dans le message de
news:%Click here to reveal e-mail address...
> 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
[Original message clipped]

Reply to this message...
Vote that this is a GOOD answer... (1 vote from another user already)
 
 
    
David Guyer [MS] (VIP)
GOOD ANSWER
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.
--------------------
[Original message clipped]

.phx.gbl
[Original message clipped]

Reply to this message...
Vote that this is a GOOD answer... (3 votes from other users already)
 
 
    
Daniel Cazzulino
GOOD ANSWER
Well, the problem now lies in that when you add a file you're adding explicitly either a Debug or Release version, and the File System information is not particular to the project build configuration. So you have to remember to change the file all the time before building :S

--------------------------------
From: Daniel Cazzulino
Reply to this message...
Vote that this is a GOOD answer... (1 vote from another user already)
 
 
    
antonio
GOOD ANSWER
It works!!!
I was having the same problem.

Thanks
Antonio

---
Posted using Wimdows.net NntpNews Component -

Post Made from http://www.DotNetJunkies.com/newsgroups Our newsgroup engine supports Post Alerts, Ratings, and Searching.
Reply to this message...
Vote that this is a GOOD answer... (1 vote from another user already)
 
 
 
System.Reflection.Assembly
System.Runtime.InteropServices.AssemblyRegistrationFlags
System.Runtime.InteropServices.RegistrationServices




Multimobile Development: Building Applications for any Smartphone
Ad
BootFX
Reliable and powerful .NET application framework.
iOS, Android and Windows Phone Development Training and Consultancy
Hosted by RackSRV Communications
 
Multimobile Development: Building Applications for any Smartphone
Copyright © AMX Software Ltd 2008-2010. Portions copyright © Matthew Baxter-Reynolds 2001-2010. All rights reserved.
Contact Us - Terms of Use - Privacy Policy - 4.0.30129.1734