Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Visual Studio.NET / Extensibility / February 2005

Tip: Looking for answers? Try searching our database.

ComRegisterFunctionAttribute doesnt work?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Bill Foust - 26 Jan 2005 16:43 GMT
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
Carlos J. Quintero [.NET MVP] - 27 Jan 2005 13:35 GMT
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


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.