Search code examples
windowsdllsetup-project

Register and unregister a DLL in a Windows Setup Project


I have couple of dll files that need to be registered/unregistered when a Windows installer is installed/uninstalled respectively.

I tried the following - Created a .bat file to register the dll. The issue is I am not able to add a .bat file using 'Custom Actions' in Setup Project.

Also, how to run unregister dll while uninstalling ? Please advice. Thanks.


Solution

  • Below info is my registering DLL steps:

    1. Add "Common Files" folder.
    2. Add your DLL-files into this folder.
    3. Modify DLL file's property "Register" to "`vsdrfCOMSelfReg"

    Now settings done.

    After you install your project, you can find Common Files folder exists with DLL (like my path "C:\Program Files (x86)\Common Files")

    You can find DLL key has been registered in your RegEdit too.

    If you uninstall your project, those info will be removed.