Hallo Oleg, i have a question and hope, that you can help me with. Is it possible to get already running application or wait until user close application manually. After that to perform major upgrade ? For windows services works fine, cause service will be stopped by msi and uninstall and newer version will be installed. How to make msi-installer to do same for exe in major upgrade ?
C#
new Project("",
new CloseApplication("MyApp.exe", true, false)),
Many thanks, @Xaddan . CloseApplication should be add to file for exe like new File (...), new CloseApplication("MyApp.exe", true, false) , am i right ?
No, belongs to the Project
thanks again, @Xaddan.
there is no diffrence if msi shoul be installed or run in silent mode with parameters /qn or /quit, right?
Judging by this article, there is no difference between /qn and /quiet
ok. many thanks, @oleg-shilo. What about diffrent UILevel ? In silent mode example , managedaction will be executed only if it in UILevel > 3 (silent ?) . how do i perform major upgrade silent from msi ? i tried it with processtartinfo and process same with parameters /i e.msifile /q /qn. unfortunatlly, seems doesnt work for me. cause msi says, app is already executed. i need to stopp or close it, before install. Here i only dont know how. that all.
I am not sure what would be a good case for closing the app depending on UILevel. That's why I think new CloseApplication("MyApp.exe", true, false)), is a more appropriate solution.
But if you for whatever reason still want to evaluate UILevel then you can do it from a managed custom action
C#
static void project_Load(SetupEventArgs e)
{
if ((e.IsInstalling || e.IsUpgrading) && e.UILevel > 3)
Process.GetProcessByName("myapp").WaitForExit();
. . .
big thanks, @oleg. i going to try it. My reason for UIlevel is autoupdater. Works in night and updated one of my components. I was hopping, i can create msi for majorupgrade if someone start msi and if it perform from taskscheduler silent install /upgrade. i think i need some deep research of bundle / bootstapper. until now all updates was executed by user.
It is worth noting that WaitForExit() will not force the application to close, it will simply block the stream and wait for the application to close. The application will need to be closed in another way, sending him a message about closing or issuing a message to the user so that he closes it.
@oleg-shilo, it would be nice to do automatic generation of CloseApplication for all executable files (except services), and add a parameter to the File (for example, AddCloseApplication) to disable generation for a specific file.
And by the way, in order for CloseApplication to work, you must also add a link to the WixCloseApplications action:
C#
new Project("",
new CustomActionRef("WixCloseApplications", When.Before, Step.CostFinalize, new Condition("VersionNT > 400"),
new CloseApplication("MyApp.exe", true, false)),
Agree. Changed it to _enhancement_
Done. Waiting for release.
C#
new Project("MyProduct",
new Dir(@"%ProgramFiles%\My Company\My Product",
new File(@"..\Install Files\Files\Bin\MyApp.exe") { AddCloseAction = true }),
AddCloseAction is disabled by default.
Most helpful comment
Done. Waiting for release.
C# new Project("MyProduct", new Dir(@"%ProgramFiles%\My Company\My Product", new File(@"..\Install Files\Files\Bin\MyApp.exe") { AddCloseAction = true }),AddCloseActionis disabled by default.