English 中文(简体)
Closing an application using WiX
原标题:

In creating my WiX installer I have run into an issue when trying to close an application before installing the upgrade. Below is an example of how I am attempting to do this.

<util:CloseApplication Id="CloseServe" CloseMessage="yes" Target="server.exe" ElevatedCloseMessage="yes" RebootPrompt="no"/>
<InstallExecuteSequence>      
  <Custom Action="WixCloseApplications" After="RemoveExistingProducts" />
  <RemoveExistingProducts After="InstallInitialize"/>
  <Custom Action= LaunchApplication  After= InstallFinalize />
  <!--<Custom Action= StopServer  Before= RemoveExistingProducts />-->
</InstallExecuteSequence>

Using this example the application does end up closing but the installation gets stalled at that point and then performs a rollback. Could this be due to the fact that the exe is removed prior to trying to close it? I have tried changing the sequence around so that RemoveExistingProducts is performed after the WixCloseApplications but it then gives me an error code 2613.

最佳回答

You could try logging the installation and see what you can track down from there. Try running the installer from the command console like so:

msiexec.exe /i [msi filename] /log [filepathlogfilename.log]
问题回答

UPDATE: Newer sample of WiX CloseApplication


I would assume that you need to close the running application as early as possible in the InstallExecuteSequence, and certainly before InstallInitialize which starts the Windows Installer transaction that makes changes to the system.

In addition you should run the same ApplicationClose operation in the InstallUISequence as well so the application is closed while you cycle through the installation menus interactively. The whole InstallUISequence is skipped when you install silently, so you need it in the InstallExecuteSequence as well.

Be aware that you can accidentially trigger rollback in a custom action by returning an exit code / error code that msiexec.exe interprets as an error. If the completion of the custom action isn t crucial, I turn off error checking to allow the install to continue. In this case that would just cause a reboot to be required.

If what you are trying to close or shut down is a service, MSI has built-in features to deal with this via the ServiceControl and ServiceInstall elements (and others).





相关问题
Correct place to install demostration projects?

With the new Windows 7 restrictions (well, new to Windows Vista anyways), we can no longer install demo projects to %ProgramFilesFolder%OurApplicationdemo since restricted users will not be able to ...

.deb package conffiles problem

I am distributing one of my applications using a .deb package, but have a problem relating to one of the files. The distribution includes a database file which is constantly updated by the app, on a ...

Closing an application using WiX

In creating my WiX installer I have run into an issue when trying to close an application before installing the upgrade. Below is an example of how I am attempting to do this. <util:...

VS 2005 Setup - HKCU

I am trying to fix an existing application that uses a Visual Studio 2005 setup project. We are requiring it to work on limited user accounts for XP, our app is written in C# for .Net 2.0. It writes ...

Do I want Publish or Release Build in VB.net?

I wrote a little (like 40 lines little) Winforms application with VB.net in Visual Studio 2010. Now I ve released the code as a Google Code project. It s easy for a developer to get the source but I d ...

configsource and installer

I have an project csproj, with app.config file, and logging Ent.Library section using configsource attribute. The logging section is in ahother file Configloggingconfiguration.config. I have a ...

热门标签