Search code examples
c#winformsadmininstallshieldprivileges

How to register interop .net asssembly per user Without Administrator Privileges using InstallShield


I am working on a task not to prompt a normal user a popup(UAC) for approval to install windows Addin application while registering a .net assembly during installation using instalshield. On windows xp, its working fine but during installation on vista and windows 7, a popup comes up for approval. As per the requirement, it shouldnt come. Is there any way to bypass this pop up on vista and windows 7 if UAC is on and registered the assembly per user without administrator privileges?

Kindly help?

Thank You.


Solution

  • Actually, COM can be registered per-user or per-machine as HKEY_CLASSES_ROOT is a view derived from both HKEY_CURRENT_USER\Software\Classes and HKEY_LOCAL_MACHINE\Software\Classes. If you run regasm /regfile:foo.dll you can generate a regfile and then change all the references in the key names to make it local to the current user.

    In the .reg file that gets generated, all the reg key additions will be to HKEY_CLASSES_ROOT. You need to replace these with "HKEY_CURRENT_USER\Software\Classes".

    Also if you need the COM registration to work with 32 bit applications and you're running x64, then for additions to HKEY_CLASSES_ROOT\CLSID, you'll need to insert "\Wow6432Node" before the CLSID token like.

    To be clear, additions to "HKEY_CLASSES_ROOT\CLSID" become "HKEY_CURRENT_USER\Software\Classes\Wow6432Node\CLSID". To make it work on x86 you only need to make this change for CLSID entries.

    Also, in certain situations, you can consider making use of Registration Free COM Interop by creating a manifest file for the EXE that consumes the COM server to make the ProgID/ClassID's available to the EXE without actually writing the registration information to the registry.