I`m use WIX.sharp for create msi. Please help me: how to run exe file after installation servise? Now it leads to an error (when I use my msi). My application starts for init cofiguration file of service. Now it seems like this:
project.Binaries = new[]
{
new Binary(new Id("StartAdmin"), "xxx.exe")
};
project.Actions = new WixSharp.Action[]
{
new BinaryFileAction("StartAdmin", "Executing ...", Return.check, When.After, Step.InstallExecute, Condition.NOT_Installed)
{
Execute = Execute.commit
}
Thanks. I did what I asked. I want to share the result.
using Microsoft.Deployment.WindowsInstaller;
...
var project = new Project("Application Name", GetAllEntities(releaseDir, parentDir, out service));
...
private static Dir GetDirs(string releaseDir, string parentDir, out File service)
{
var docDir = System.IO.Path.GetFullPath(System.IO.Path.Combine(parentDir, @"pub\\doc\\"));
return new Dir(new Id("SERVICEDIR"), @"%ProgramFiles%\Application\",
new Dir(new Id("INSTALLSERVICEDIR"), "App name",
new Dir(new Id("BINSERVICEDIR"), "bin",
...
new File(string.Format("{0}{1}", releaseDir, "Admin.exe")),
...
project.AddAction(new ManagedAction(CustomActions.MyAction, Return.check, When.After, Step.InstallFinalize, Condition.NOT_Installed));
...
public class CustomActions
{
[CustomAction]
public static ActionResult MyAction(Session session)
{
System.Diagnostics.Process process = new System.Diagnostics.Process();
process.StartInfo.FileName = string.Format("{0}\\Admin.exe", session["BINSERVICEDIR"]);
process.StartInfo.Arguments = "-n";
process.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Normal;
process.Start();
process.WaitForExit();
return ActionResult.Success;
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.