none
not able to load .cmd(mycmd.cmd) file while installing application using MSI RRS feed

  • Question

  • Hi,

    i have two projects:
    1. library project
    2. set up project

    in library project, i have added custom action(install and uninstall) methods.

    for testing purpose, i have added message box to show while installing and uninstalling application(this is working fine)

    but, i have mycmd.cmd file need to execute before installing the application and it is not able to load the cmd file while installing the application..

    sample code:

    public override void Install(IDictionary savedState)
            {
               
                base.Install(savedState);
                System.Windows.Forms.MessageBox.Show("installing Application....");//this message box getting displayed while installing
                 var fileName = Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), @"cleanreg.cmd");
                System.Diagnostics.Process process = new System.Diagnostics.Process();
                System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
                //startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
                startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Maximized;
                startInfo.FileName = fileName;
                startInfo.Verb = "runas";
                process.StartInfo = startInfo;
                process.Start();
              

            }

    any help would be greatly appreciated.

    Regards,

    Yogi


    yogi

    Tuesday, February 6, 2018 7:02 PM

All replies

  • Have you displayed the value of fileName and confirmed that the path is correct?

    What errors occur?

    Tuesday, February 6, 2018 7:57 PM
  • Hi yogi setty,

    Thank you for posting here.

    >>but, i have mycmd.cmd file need to execute before installing the application and it is not able to load the cmd file while installing the application..

    If you want to execute the .cmd file before installing, please run the code before the base.Install(SaveState).

    >>Path.GetDirectoryName(Assembly.GetEntryAssembly().Location)

    This location return the directory of your current project Bin\Debug file. Please check the Dubug file, whether the .cmd exist or not.

    Best Regards,

    Wendy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, February 7, 2018 1:36 AM
    Moderator