Search code examples
c#.netinstallshieldregsvr32system32

Framework/Framework64 and System32/Syswow64


I built my project as 64bit (not ANY CPU) but specifically 64bit. All the dll's are 64bit; most of the them are managed code (C#), and a few files are unmanaged (C++ code).

I am creating a Installer in Installshield and I need to register dll's. I have read so much online that I am confused.

  • regsvr32 -> To register my C++ dll's, which regsvr32.exe should I use? System32 or Syswow64.
  • regasm -> To register my C# dll, which regasm I should use? framework/framework64

Solution

  • On a 64-bit system, as viewed by a 64-bit application:

    • System32: contains 64-bit system files
    • SysWow64: contains 32-bit system files

    On a 64-bit system, as viewed by a 32-bit application:

    • System32: typically redirected to SysWow64, so accesses 32-bit system files
    • SysNative: redirected to the real System32; accesses 64-bit files

    On a 64-bit system, with filesystem redirection disabled (see IntallScript's WOW64FSREDIRECTION or Windows's Wow64DisableWow64FsRedirection) if you happen to have a path to the System32 folder, it will access the 64-bit files.

    Regasm is not in this location; instead the 32-bit build is in Windows\Microsoft.NET\Framework\<version> and the 64-bit build is in Windows\Microsoft.NET\Framework64\<version>. No weird folder names here, but it's not the system folder.

    Note: Registering a file requires the correct bitness and correct application. Furthermore if you are creating a Windows Installer Package (e.g. a Basic MSI project) you should not be calling tools like this at installation time; you should instead use build-time tools like COM Extraction for native DLLs and COM Interop for managed assemblies to turn their self-registration into MSI data: mark the component's 64-bit setting correctly and InstallShield is supposed handle the rest.