-
Notifications
You must be signed in to change notification settings - Fork 176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Restart Office apps after installation #1598
Comments
morning, remeber that you can always use AfterInstall Event from WixSharp in your msi packafge. Difficulty here is , to use external Process to do something. windows installer is bad to use something outside of installer, unfortunatelly. |
@Torchok19081986 Cannot switch to a BA installer now .Need to use the restart manager as its the only API which I found which kills the application and restarts from where it was killed ...something like a restore . |
then only one way direct to restart manager with MSI installer and msi package. Try afterinstall event from Wixsharp. [CustomAction]
public static ActionResult StartRestartManager(Session session)
{
//here comes the code, BUT somehow you have to execute exe from here direct. something like session["INSTALLDIR"] = Process.Start("Restartmanager") will be not work, you have to deal with process startinfo and path to restart manager and here msi doesnt want it execute it.
} |
@Torchok19081986 Can you explain a bit more ?i Did not get the last part |
The issue I am facing is applications are getting shutdown but not restarted |
that i said, you have to figured out, how to call restartmanager with parameters within CA. Try use class ProcessStartInfo and add verbs or verb to it. If your Restartmanager doesnt have parameter to restart apps after action, i think, you can try use Process Class , here you can kill and restart process by name. All another things you can , maybe, examinate log from wixshar in temp or window errorlog. |
Actually, you can start any application from the I am not sure what exactly you are referring to as RestartManager as this term is somewhat overused. project.AfterInstall += args =>
{
if (!args.IsUninstalling)
Process.Start("shutdown", "-r")
}; Or if you want to use the |
hallo, @oleg-shilo. Was my suggestion, but @Aaswin1996 want to use special restartmanager and dont want use shutdown. |
"shutdown.exe" is just a windows utility |
Then I have no idea what "restartmanager" is. |
@oleg-shilo @Torchok19081986 RestartManager is a windows API which is written in c++ which helps in gracefully shutting down applicatioand and then restarting them from where it was shutdown . I am using this as a wrapper code in c# to access c++ native functions : https://gist.github.com/falahati/34b23831733151460de1368c5fba8e93 My use case is after installation I want to restart outlook and excel .Restart means shutdown and resume from where it was shutdown |
Great, I looked at the code you shared. It is a pure interop (WIN API) so you have no dependency on anything. then add that cs file to your project and then call the restart routine from the AfterInstall event handler: project.AfterInstall += args =>
{
if (!args.IsUninstalling)
using (var rm = new RestartManagerSession())
{
rm.RegisterProcess(Process.GetProcessesByName("explorer"));
rm.Shutdown(RestartManagerSession.ShutdownType.Normal);
rm.Restart();
}
} |
But of course replace |
@oleg-shilo It does not work Shutdown happens but Restart Fails |
Then you need to follow it with that "retstartmanager" solution that you use. I say, try it outside of WixSharp (unless you already did it). Verify that it works and only when it does integrate it into your setup. |
@oleg-shilo Its working outside only when I merge it with WixSharp it starts failing |
OK, then maybe it the difference is caused by the fact that this API is called from the elevated process (your install session). However, you can just try to unelevate your afterinstall: project.AfterInstallEventExecution = EventExecution.MsiSessionScopeImmediate; Small chance, but it might work |
|
Wait, so you have the error information! I suggest you now look at the RestartManager service documentation for the solution. |
@oleg-shilo The issue is that normally without MSI this works fine but when I include it in the WixSharp restarting applications starts failing |
Yes I understand the issue. Though it's not "in the WixSharp restarting applications". It happens when you do it from the MSI session. Why it is happening can only be understood by digging in the restartmanager documentation. WixSharp documentation will not help you. Neiter WiX nor MSI. This is something specific for restartmanager. |
hallo, @Aaswin1996. If you have library of RestartManager , you coult try defered CA from External Assembly. I had same issue wiith 3. party Libs for creating Task for Windows TaskScheduler. External Assembly for execution in CA brought the solution for me. Thanks to @oleg-shilo. |
My installer adds registry keys for VSTO addins to my office application .I want to restart office apps after installation so that the vsto addins are loaded after installation .Is there a way to do this in WixSharp .I want to use the Restart Manager for this purpose .
The text was updated successfully, but these errors were encountered: