How to restart WPF application after it has been updated using click-once, i need to start the new version!
There are a few ways but most don't work correctly, they end up reopening the old version.
It's going to sound crazy that WPF doesn't have a proper way to handle it (#fixwpf), but you'll need to reference System.Windows.Forms.dll
and call System.Windows.Forms.Application.Restart();
A quick search found Rob Relyea's post about the same thing (XAML, WPF Microsoft Guy) http://robrelyea.wordpress.com/2007/07/24/application-restart-for-wpf/
It isn't necessary to include the winforms assembly just for this, that seems like overkill.
You can do the same thing that winforms does behind the scenes in it's restart method. After the Update Has been applied:
String ApplicationEntryPoint = ApplicationDeployment.CurrentDeployment.UpdatedApplicationFullName; Process.Start(ApplicationEntryPoint); //shutdown current instance here
This Will Start the New Version Of Your Application With the proper ClickOnce initialization.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With