I have an assembly that is an EXE. I want to do some basic registration when
I install the file to see the registry. I added two functions and put the
[ComRegisterFunctionAttribute] and [ComUnregisterFunctionAttribute] on them
appropriately. However the functions are never getting called with I run
REGASM.EXE on the compiled EXE. Is this not the right thing to use? I just
want to see the registry when the file gets installed and not make a
seperate registry install script to do it.
Bill
It should work provided that:
1) They are in a public class
2) The class has the ComVisible(True) atrribute, etc.
3) You are using regasm.exe or the registration services of the .NET
framework to register the assembly. That is, it does not work with other
setups.
This should work, try it:
<ComVisible(True), Guid(g_GUID), ProgId(g_ADDIN_CONNECT_PROGID)> _
Public Class MyClass
<System.Runtime.InteropServices.ComRegisterFunction()> _
Private Shared Sub RegisterFunction(ByVal type As Type)
...
End Sub
<System.Runtime.InteropServices.ComUnregisterFunctionAttribute()> _
Private Shared Sub UnregisterFunction(ByVal type As Type)
...
End Sub

Signature
Carlos J. Quintero
MZ-Tools 4.0: Productivity add-ins for Visual Studio .NET
You can code, design and document much faster.
http://www.mztools.com
>I have an assembly that is an EXE. I want to do some basic registration
>when
[quoted text clipped - 7 lines]
>
> Bill
Bill Foust - 14 Feb 2005 19:27 GMT
Are there any other restrictions? I have some assemblies that this seems to
work on, but others that it does not. These are assemblies that the ONLY
THING im using this for is to provide a mechanism to pre-populate the
registry during install time. They are all C#, .NET DLL assemblies.I have
one EXE and one DLL that works, but 2 DLLs that do not.
> It should work provided that:
>
[quoted text clipped - 29 lines]
> >
> > Bill
Carlos J. Quintero [.NET MVP] - 15 Feb 2005 09:41 GMT
> Are there any other restrictions?
Not that I am aware of right now.
> I have some assemblies that this seems to
> work on, but others that it does not. These are assemblies that the ONLY
> THING im using this for is to provide a mechanism to pre-populate the
> registry during install time. They are all C#, .NET DLL assemblies.I have
> one EXE and one DLL that works, but 2 DLLs that do not.
Then you will have to see carefully the differences between a DLL that works
and the other that doesn´t work. So you can make temporary copies of their
source code and add/remove code from one of them until both work or not. At
that point you will find out why.

Signature
Carlos J. Quintero
MZ-Tools 4.0: Productivity add-ins for Visual Studio .NET
You can code, design and document much faster.
http://www.mztools.com