Search code examples
c#processinno-setup

Inno command line compilation not working


I'm trying to compile .iss file with command line

            string INNOCLI = Application.StartupPath + @"\Inno\ISCC.exe";
            string Argument = string.Format("iscc /q \"{0}\"", INNOSCRIPTFILE);

            using (Process cli = new Process())
            {
                //cli.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
                cli.StartInfo.FileName = INNOCLI;
                cli.StartInfo.Arguments = Argument;
                cli.StartInfo.UseShellExecute = false;
                cli.StartInfo.RedirectStandardError = true;
                cli.StartInfo.RedirectStandardOutput = true;
                //cli.StartInfo.CreateNoWindow = true;
                cli.OutputDataReceived += cli_OutputDataReceived;
                cli.ErrorDataReceived += cli_ErrorDataReceived;
                cli.Start();
                cli.BeginErrorReadLine();
                cli.BeginOutputReadLine();
                cli.WaitForExit();
            }

But i'm getting nothing out of it, i'm using c#

Edit: I disabled output redirect, now i see its saying "Script file name specified more than once" on console window.


Solution

  • You've said that the output you get from the ISCC tool that you execute is:

    Script file name specified more than once

    which comes from this exception which is raised if you pass more than one parameter longer than 1 char with no starting /, or - char. And that's what happens because you have mistakenly passed iscc and a file name to your arguments. Remove that mistyped iscc from there. Change this line:

    string Argument = string.Format("iscc /q \"{0}\"", INNOSCRIPTFILE);
    

    to this:

    string Argument = string.Format("/q \"{0}\"", INNOSCRIPTFILE);