We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

gvnsandeep
Posts: 7
Joined: Tue Aug 11, 2020 3:23 pm

How to build the AIP Project from a C# Project

Hi,

We are in the process of automating the builds of Advanced Installer Projects. Could you please help on "How can I achieve the same from a C# Project"?

I have tried invoking the command line arguments from a C# Project. However it didn't worked, I am not sure where I am going wrong. I am attaching a project, could you please go through that and let me know where I am going wrong?

Here is the code which I am using in C#

Process p = new Process();
ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.WorkingDirectory = @"C:\Program Files (x86)\Caphyon\Advanced Installer 17.7\bin\x86\";
startInfo.FileName = @"C:\Program Files (x86)\Caphyon\Advanced Installer 17.7\bin\x86\AdvancedInstaller.com";
startInfo.Arguments = @"AdvancedInstaller.com /edit ""\C:\Users\sandeep\Documents\Advanced Installer\Projects\Test.aip\"" / SetVersion 3.1.201";
startInfo.RedirectStandardOutput = true;
startInfo.UseShellExecute = false;
startInfo.CreateNoWindow = true;
p.StartInfo = startInfo;
p.Start();
string result = p.StandardOutput.ReadToEnd();
MessageBox.Show(result.ToString());

Regards,

Sandeep.
Attachments
Command Prompt POC.zip
(36.7 KiB) Downloaded 224 times
Catalin
Posts: 7853
Joined: Wed Jun 13, 2018 7:49 am

Re: How to build the AIP Project from a C# Project

Hello Sandeep,

The problem seemed to be caused by multiple typos in the passed arguments.

Code: Select all

startInfo.Arguments = @"AdvancedInstaller.com /edit ""\C:\Users\sandeep\Documents\Advanced Installer\Projects\Test.aip\"" / SetVersion 3.1.201";
First of all, please note that you are already providing the path to the AdvancedInstaller.com tool here:

Code: Select all

startInfo.FileName = @"C:\Program Files (x86)\Caphyon\Advanced Installer 17.7\bin\x86\AdvancedInstaller.com";
Therefore:

Code: Select all

startInfo.Arguments = @"AdvancedInstaller.com /edit ""\C:\Users\sandeep\Documents\Advanced Installer\Projects\Test.aip\"" / SetVersion 3.1.201";
should look like this:

Code: Select all

startInfo.Arguments = @"/edit ""\C:\Users\sandeep\Documents\Advanced Installer\Projects\Test.aip\"" / SetVersion 3.1.201";
Secondly, please note that you have an extra backslash character ("\") here:

Code: Select all

""\C:\Users\sandeep\Documents\Advanced Installer\Projects\Test.aip\""
The above should look like:

Code: Select all

""C:\Users\sandeep\Documents\Advanced Installer\Projects\Test.aip\""
The one before the C:\ drive.

Lastly, you have an extra space here:

Code: Select all

/ SetVersion 3.1.201
The above should look like this:

Code: Select all

/SetVersion 3.1.201
The final command line should look like this:

Code: Select all

startInfo.Arguments = @"/edit ""C:\Users\sandeep\Documents\Advanced Installer\Projects\Test.aip\"" /SetVersion 3.1.201";
AfterRunningExecutable.png
AfterRunningExecutable.png (281.79 KiB) Viewed 1820 times


Hope this helps!

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”