Registering a managed DLL file can be simple process if you know the correct .NET version. Registering process is slightly different for 32, 64 bit and .NET version. There is no straight way to know .NET version, using a tool like JustCompile is useful to get the .NET version, also shows internal properties and method regarding the DLL.
Once we know the .NET version and 32 or 64 bit variant of the DLL, we need to run windows command prompt in elevated mode. If the .NET version is 2.0 and 32 Bit, run this command below –
C:\Windows\Microsoft.NET\Framework\v2.0.50727\RegAsm.exe <absolutePathToYourDLL.dll> /register /codebase /tlb
To register a 64 bit assembly, simply need to refer to 64 bit framework
C:\Windows\Microsoft.NET\Framework64\v2.0.50727\RegAsm.exe <absolutePathToYourDLL.dll> /register /codebase /tlb
Above command will generate a .tlb (typeLibFile) and /codebase basically register the assembly globally. Here you can find documentation.
To register a .NET 4 and 32 bit assembly run the command below –
C:\Windows\Microsoft.NET\Framework\v4.0.30319\regasm.exe <absolutePathToYourDLL.dll> /register /codebase /tlb
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\regasm.exe <absolutePath.dll> /register /codebase /tlb
To unregister .NET 2.0 DLL run below command
C:\Windows\Microsoft.NET\Framework\v2.0.50727\RegAsm.exe <absolutePath.dll> /unregister
In the same way to unregister a .NET 4.0 assembly, run the command below
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\regasm.exe <absolutePath.dll> /unregister
Hope it will help you.
Happy coding 🙂