Ask a questionAsk a question
 

AnswerShellExtension dll with MSI

  • Friday, October 30, 2009 10:13 AMha_rish77 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi,
    I have created a shell extension dll using C++. It is getting registered with regsvr32 and working fine.
    Now I am creating an MSI installer for this , but I am getting the following issues.

    1. In the setup project , if I specified "primary output properties " for register as "vsdrpCOM".  On building the setup project I get
       Unable to create registration information for file named 'SimpExt.dll'. I tried changing the dll's OLESelfRegister property to 1 manually in .res file , but that too didnt help.

    2. If I change the Register type to vsdrpCOMSelfReg, it fails during installation.

    3. I tried adding a custom action using ORCA as specified by http://social.msdn.microsoft.com/forums/en-US/windowscompatibility/thread/11c65800-e751-458d-a77c-ae069f44f9f2/

    Changed the Register type to vsdrpDoNotRegister and set
    Target as regsvr32.exe /s . But that too giving error during installation
    [[  Error 1721. There is a problem with this Windows Installer package. A program required for this install to complete could not be run. Contact your support personnel or package vendor. Action: RegDll, location: C:\MyExplorer\, command: regsvr32 /s SimpExt.dll  ]]


    This dll does not have any dependency dlls as shown by the setup project [ detected Dependencies] .
    I have selected the Primary output from the dll project. This consits of the DLL


    How can I register a Shell extension DLL (Win32-COM) using Windows Installer MSI ?


    thanks
    Harish

Answers

  • Monday, November 02, 2009 11:05 AMJialiang Ge [MSFT]MSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Hello Harish

    As far as I know, the vsdrpXXXX options are only effective for .NET assemblies that are exposed as a COM components. They do not work for native COM components.

    I have not tried ORCA custom actions. However, VS setup projects support another kind of custom action:
    http://msdn.microsoft.com/en-us/library/d9k65z2d.aspx
    In the custom action, you can call Process.Start to launch regsvr32 to register your dll.

    Please try this solution and let me know whether it works for you.
    Regards,
    Jialiang Ge
    MSDN Subscriber Support in Forum
    If you have any feedback of our support, please contact msdnmg@microsoft.com.
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
  • Tuesday, November 24, 2009 4:01 AMha_rish77 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    Hello Jialiang Ge,
    Sorry for the late reply. I was away for some days.

    I have tried adding Installer class to the project , but initially it did not succed. After your mail I just tried the sample project http://msdn.microsoft.com/en-us/library/d9k65z2d.aspx and it worked.
    The wrong thing I was doing was that I was adding the Installer.cs to the existing project.
    Later I have added another project to the solution having the Installer class
    Override the Install/Unstall methods
    public override void Install(System.Collections.IDictionary stateSaver)
            {
                base.Install(stateSaver);
                string assemblyname = Context.Parameters["ASSEMBLY"];
                if (assemblyname != null)
                {
                    //System.Diagnostics.Debugger.Break();

                    Assembly asm = Assembly.GetExecutingAssembly();
                    string asmName = asm.Location;
                    int bsIndex = asmName.LastIndexOf("\\");
                    string asmDirName = asmName.Remove(bsIndex, asmName.Length - bsIndex);
                    string dllpath = asmDirName + "\\" + assemblyname;
                    RegisterDll(" /s ", dllpath);
                }
            }
    and in RegisterDll added
    Process p = new Process();
    p.StartInfo.FileName = @"regsvr32.exe";
    p.StartInfo.UseShellExecute = false;
    p.StartInfo.Arguments = string.Format(" {0}  \"{1}\" ", parameters, dllPath);
    p.Start();
    p.WaitForExit();

    In the installer project , Custom Actions - Install , I passed CustomActionData as /ASSEMBLY="MyDll.dll"
    Also added code for UnInstall in the same line.
    In the setup project I set the Register property as vsdrpNotregister. This is taken care of by the Custom action.

    thanks a lot Mr. Jialiang Ge.

    Harish

All Replies

  • Monday, November 02, 2009 11:05 AMJialiang Ge [MSFT]MSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Hello Harish

    As far as I know, the vsdrpXXXX options are only effective for .NET assemblies that are exposed as a COM components. They do not work for native COM components.

    I have not tried ORCA custom actions. However, VS setup projects support another kind of custom action:
    http://msdn.microsoft.com/en-us/library/d9k65z2d.aspx
    In the custom action, you can call Process.Start to launch regsvr32 to register your dll.

    Please try this solution and let me know whether it works for you.
    Regards,
    Jialiang Ge
    MSDN Subscriber Support in Forum
    If you have any feedback of our support, please contact msdnmg@microsoft.com.
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
  • Friday, November 06, 2009 6:17 AMJialiang Ge [MSFT]MSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Hello

    How are you? May I know the current status of the issue on your side? If you have any other questions, please feel free to post here.


    Regards,
    Jialiang Ge
    MSDN Subscriber Support in Forum
    If you have any feedback of our support, please contact msdnmg@microsoft.com.
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
  • Tuesday, November 24, 2009 4:01 AMha_rish77 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    Hello Jialiang Ge,
    Sorry for the late reply. I was away for some days.

    I have tried adding Installer class to the project , but initially it did not succed. After your mail I just tried the sample project http://msdn.microsoft.com/en-us/library/d9k65z2d.aspx and it worked.
    The wrong thing I was doing was that I was adding the Installer.cs to the existing project.
    Later I have added another project to the solution having the Installer class
    Override the Install/Unstall methods
    public override void Install(System.Collections.IDictionary stateSaver)
            {
                base.Install(stateSaver);
                string assemblyname = Context.Parameters["ASSEMBLY"];
                if (assemblyname != null)
                {
                    //System.Diagnostics.Debugger.Break();

                    Assembly asm = Assembly.GetExecutingAssembly();
                    string asmName = asm.Location;
                    int bsIndex = asmName.LastIndexOf("\\");
                    string asmDirName = asmName.Remove(bsIndex, asmName.Length - bsIndex);
                    string dllpath = asmDirName + "\\" + assemblyname;
                    RegisterDll(" /s ", dllpath);
                }
            }
    and in RegisterDll added
    Process p = new Process();
    p.StartInfo.FileName = @"regsvr32.exe";
    p.StartInfo.UseShellExecute = false;
    p.StartInfo.Arguments = string.Format(" {0}  \"{1}\" ", parameters, dllPath);
    p.Start();
    p.WaitForExit();

    In the installer project , Custom Actions - Install , I passed CustomActionData as /ASSEMBLY="MyDll.dll"
    Also added code for UnInstall in the same line.
    In the setup project I set the Register property as vsdrpNotregister. This is taken care of by the Custom action.

    thanks a lot Mr. Jialiang Ge.

    Harish

  • Tuesday, November 24, 2009 6:00 AMJialiang Ge [MSFT]MSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    You are welcome, Harish


    Regards,
    Jialiang Ge
    MSDN Subscriber Support in Forum
    If you have any feedback of our support, please contact msdnmg@microsoft.com.
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.