Home > Mobile >  Regsvr32 .dll registration. How can i build my own Setup?
Regsvr32 .dll registration. How can i build my own Setup?

Time:03-22

How can i build my own Setup to register a .dll file?

My puplished programm missing one .dll and its necessary for starting. i referenced it to my program but i cannot toggle "save on local" to True. its not checkable.

Now i want to create installer for this problem.

How can i do this? the installer have to run this in cmd: regsvr32 file.dll

i tried to make a batch but all batch codes for regsvr32 dont work. not on my and not on other computers. i tried it so long and hope someone have a idea.

CodePudding user response:

Well I assume your dll was built targeting .net 4 so regsrv32 will not work (Win32 only).

What you need to use is regasm, which is buried in the .net framework folders - one each for 32 & 64 bit.

%SystemRoot%\Microsoft.NET\Framework\v4.0.30319\regasm  my_32_bit.dll
%SystemRoot%\Microsoft.NET\Framework64\v4.0.30319\regasm my_64_bit.dll

regasm options;

Microsoft .NET Framework Assembly Registration Utility version 4.8.4161.0
for Microsoft .NET Framework version 4.8.4161.0
Copyright (C) Microsoft Corporation.  All rights reserved.

Syntax: RegAsm AssemblyName [Options]
Options:
/unregister          Unregister types
/tlb[:FileName]      Export the assembly to the specified type library
                     and register it
/regfile[:FileName]  Generate a reg file with the specified name
                     instead of registering the types. This option
                     cannot be used with the /u or /tlb options
/codebase            Set the code base in the registry
/registered          Only refer to already registered type libraries
/asmpath:Directory   Look for assembly references here
/nologo              Prevents RegAsm from displaying logo
/silent              Silent mode. Prevents displaying of success messages
/verbose             Displays extra information
/? or /help          Display this usage message

CodePudding user response:

There are a number of installer technologies available to help build an installation package for Windows. My personal preference is the WIX Toolset.

While you may be able to accomplish what you are asking via some type of script, it's a best practice to create an installation package (such as an .msi or setup.exe).

A mature tool such as WIX will help with things such as cleaning up the system on uninstall, rolling back properly if the installation fails for some reason, logging which can help with troubleshooting, etc., which all wouldn't be covered by a simple script.

  • Related