Error In Registering Dll File in windows 7?


  • Hi All,

    I have created a Dll file using a class library,but when i tried to register that dll it is throwing following error

    And My Code is as follows

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Runtime.InteropServices;
    namespace ActiveXSampleApp
        public class Class1
                    public string Something()
                        return "Hi Am from Library File";

    Any Suggestion Would be of great help



    Friday, April 26, 2013 6:00 AM


All replies

  • Type "regsvr32 name.dll" into the Command Prompt and press "Enter." Note that "name.dll" should be replaced with the name of the DLL that you want to register. For example, if you want to register the iexplore.dll, type "regsvr32 iexplore.dll."

    Well, you don't specify if it's a 32 or 64 bit dll and you don't include the error message, but I'll guess that it's the same issue as described in this KB article: Error Message When You Run Regsvr32.exe on 64-Bit Windows

    Quote from that article:

    This behavior occurs because the Regsvr32.exe file in the System32 folder is a 64-bit version. When you run Regsvr32 to register a DLL, you are using the 64-bit version by default.

    Solution from that article:

    To resolve this issue, run Regsvr32.exe from the %SystemRoot%\Syswow64 folder. For example, type the following commands to register the DLL:
    cd \windows\syswow64
    regsvr32 c:\filename.dll

    If the DLL is 32 bit:

    Copy the DLL to C:\Windows\SysWoW64\
    In elevated cmd: %windir%\SysWoW64\regsvr32.exe %windir%\SysWoW64\namedll.dll

    if the DLL is 64 bit:

    Copy the DLL to C:\Windows\System32\
    In elevated cmd: %windir%\System32\regsvr32.exe %windir%\System32\namedll.dll

    I know it seems the wrong way round, but that's the way it works. See:
    Quote: "Note On a 64-bit version of a Windows operating system, there are two versions of the Regsv32.exe file:
    The 64-bit version is %systemroot%\System32\regsvr32.exe.
    The 32-bit version is %systemroot%\SysWoW64\regsvr32.exe.

    Friday, April 26, 2013 8:47 AM
  • Hi,

    Thanks for the Reply, I tried the way you suggested.

    But it is not working out.



    Friday, April 26, 2013 9:16 AM
  • Hi,

    Please see the doc at

    It seems you assumed that it is enough to make this a COM DLL. It still creates a .NET DLL that the regasm tool allows to expose to COM. regsvr32 is for "true" COM DLLs.

    Please always mark whatever response solved your issue so that the thread is properly marked as "Answered".

    Friday, April 26, 2013 11:17 PM
  • Building COM Objects in C#

    Faisal Ahmed Farooqui

    Saturday, April 27, 2013 8:19 PM
  • Example COM Class (C# Programming Guide)

    Faisal Ahmed Farooqui

    Saturday, April 27, 2013 8:19 PM