.NET Forum / Languages / Managed C++ / November 2007
DllUnregisterServer
|
|
Thread rating:  |
George - 30 Oct 2007 07:49 GMT Hello everyone,
I asked a related question about when DllRegisterServer is called and my question is answered. Now I am thinking that when DllUnregisterServer will be called?
It is reasonable to understand that during installation process or when we set Register Output to Yes in Visual Studio 2005, during build process of Visual Studio 2005 regsvr32.exe will invoke DllRegisterServer to put the related registration entries to Windows Registry.
But when (what operation) will trigger DllUnregisterServer be invoked in Visual Studio 2005?
thanks in advance, George
Frank Hickman - 30 Oct 2007 08:36 GMT > Hello everyone, > [quoted text clipped - 13 lines] > thanks in advance, > George regsvr32.exe has a switch to unregister a DLL.
 Signature ============ Frank Hickman NobleSoft, Inc. ============ Replace the _nosp@m_ with @ to reply.
George - 30 Oct 2007 08:57 GMT Thanks Frank,
Sorry that maybe I have not made myself understood. My question is not regsvr32 will trigger DllUnregisterServer, but how and when Visual Studio 2005 will trigger regsvr32 (or DllUnregisterServer).
Because I think Visual Studio 2005 could use Register Output option to trigger regsvr32, and then finally trigger DllRegisterServer, and Visual Studio 2005 must have some methods to trigger DllUnregisterServer as well.
Any comments?
regards, George
> > Hello everyone, > > [quoted text clipped - 15 lines] > > regsvr32.exe has a switch to unregister a DLL. Ben Voigt [C++ MVP] - 30 Oct 2007 14:42 GMT > Thanks Frank, > [quoted text clipped - 5 lines] > trigger regsvr32, and then finally trigger DllRegisterServer, and Visual > Studio 2005 must have some methods to trigger DllUnregisterServer as well. Dll(Un)RegisterServer is not designed for Visual Studio!
It is designed for an installer/uninstaller.
When you are in the early stages of your project, you might not have an installer, so Visual Studio gives you the option to register your dll. There is no option to unregister your dll, though you can do it yourself using the regsvr32 tool and the /u option.
George - 31 Oct 2007 03:34 GMT Thanks Ben,
I want to confirm with you that you mean,
1. For DllRegisterServer, we could use Visual Studio 2005 Register Output option to trigger (trigger regsvr32.exe); 2. For DllUnregisterServer, there is no option in Visual Studio 2005 to trigger (trigger regsvr32.exe)?
Right?
regards, George
> > Thanks Frank, > > [quoted text clipped - 14 lines] > There is no option to unregister your dll, though you can do it yourself > using the regsvr32 tool and the /u option. Ben Voigt [C++ MVP] - 01 Nov 2007 14:20 GMT > Thanks Ben, > > I want to confirm with you that you mean, > > 1. For DllRegisterServer, we could use Visual Studio 2005 Register Output > option to trigger (trigger regsvr32.exe); Yes.
> 2. For DllUnregisterServer, there is no option in Visual Studio 2005 to > trigger (trigger regsvr32.exe)? > > Right? There is no Yes/No option in Visual Studio to call regsvr32.exe /u, however Visual Studio supports a "Custom Build Step" which can do that easily.
> regards, > George George - 02 Nov 2007 07:27 GMT Thanks for your clarification, Ben!
regards, George
> > Thanks Ben, > > [quoted text clipped - 15 lines] > > regards, > > George adebaene@club-internet.fr - 30 Oct 2007 17:21 GMT > Thanks Frank, > [quoted text clipped - 5 lines] > trigger regsvr32, and then finally trigger DllRegisterServer, and Visual > Studio 2005 must have some methods to trigger DllUnregisterServer as well. What will be the usefullness of a DllUnregisterServer within Visual Studio?
In a typical developement process, you iteratively build again and again the same DLL, changing the source code between each build, testing with or without the debugger, etc... So, each time you rebuild the DLL, Visual Studio will invoke again DllRegisterServer, which means the same registration information will be overwritten in the Registry, always pointing to the same DLL location (where you build your DLL). Unregistering the server presents no interest!
The only reason you may want to Unregister your DLL is once you're done with the development and distribution work, and you want to get rid of the DLL on your development machine. You can do that by hand if you really want...
Arnaud
George - 31 Oct 2007 03:36 GMT Thanks Arnaud,
I want to confirm with you that you mean DllUnregisterServer is not triggered by Visual Studio build or something else process, not like DllRegisterServer which is triggered by build process.
Right?
regards, George
> > Thanks Frank, > > [quoted text clipped - 23 lines] > > Arnaud Ben Voigt [C++ MVP] - 01 Nov 2007 14:23 GMT > Thanks Arnaud, > > I want to confirm with you that you mean DllUnregisterServer is not > triggered by Visual Studio build or something else process, not like > DllRegisterServer which is triggered by build process. No, DllRegisterServer is triggered by install process, and DllUnregisterServer is triggered by uninstall process.
Since often the developer wants to test the DLL immediately after build, the build process can start the install process. There's no common case for the developer wanting to automatically start an uninstall.
> Right? > [quoted text clipped - 31 lines] >> >> Arnaud Frank Hickman - 30 Oct 2007 19:24 GMT > Thanks Frank, > [quoted text clipped - 10 lines] > regards, > George And while both of the responses from David and Arnaud above are correct, if you have some code in the DLLUnregisterServer function that is causing you problems, the only way I can think of for you to debug it would be to write a small utility which is linked to your DLL and then calls regsvr32.exe with the unregister switch. This may not work without tweaking as I have not tried it.
If however you just want the debug version unregistered from your development machine, you can add a post build option which looks just like the one created by the checkbox option but uses the unregister switch.
 Signature ============ Frank Hickman NobleSoft, Inc. ============ Replace the _nosp@m_ with @ to reply.
George - 31 Oct 2007 03:38 GMT Thanks Frank,
Your solutions are very practical. I thnk unlike DllRegisterServer, for DllUnregisterServer, I have to some manual configurations or coding work. And Visual Studio 2005 does not have something like *Unregister Output* checkbox for me to have a straightforward click. :-)
regards, George
> > Thanks Frank, > > [quoted text clipped - 21 lines] > development machine, you can add a post build option which looks just like > the one created by the checkbox option but uses the unregister switch. Ben Voigt [C++ MVP] - 01 Nov 2007 14:21 GMT > And while both of the responses from David and Arnaud above are correct, > if [quoted text clipped - 3 lines] > regsvr32.exe with the unregister switch. This may not work without > tweaking as I have not tried it. No, it's sufficient to set the debug executable to "regsvr32.exe" with a command line of "/u ${TargetPath}" or the like
> If however you just want the debug version unregistered from your > development machine, you can add a post build option which looks just like > the one created by the checkbox option but uses the unregister switch. George - 02 Nov 2007 07:29 GMT Hi Ben,
Your always have smart ideas! Cool!
have a good weekend, George
> > And while both of the responses from David and Arnaud above are correct, > > if [quoted text clipped - 10 lines] > > development machine, you can add a post build option which looks just like > > the one created by the checkbox option but uses the unregister switch.
Free MagazinesGet 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 ...
|
|
|