0

I am trying to create a self-patching app as follows:

  1. .Net WPF app determines whether a new version exists (of itself)
  2. This WPF app starts a .Net console app (process.Start) to perform the necessary
  3. The console app then performs some tasks and fires up the new version of the .Net WPF app (process.Start)

All works well, i.e. I can see the processes being started up as required, however when the console app starts the new instance of the WPF app, no window is visible - from a user's perspective it appears as if nothing loaded.

Any pitfalls I need to consider with such an approach - using console app to restart a Windows based UI?

Code starting the console (same on the console side starting the WPF app again)

var info = new ProcessStartInfo(commandFileName) 
{ 
    Arguments = args 
} 
Process.Start(info); 

The console app is not visible using this.

NubieJ
  • 575
  • 2
  • 9
  • 21
  • Is the console app visible? Show us your code (e.g. the lines where you start another process) if you want decent help! – noelicus Jan 22 '14 at 11:53

2 Answers2

0

This post might help you display the console. Then adding Console.ReadLine() should keep the window open.

Community
  • 1
  • 1
twrowsell
  • 467
  • 3
  • 8
0

Ok, my mistake - missed the most critical part of the puzzle...

It is a Windows service that does the actual Process.Start call, i.e. the original WPF app performs a call to this service which starts the Console app (which then eventually restarts the WPF app).

It is therefore clear what the problem was: A Windows Service will not interact with the desktop, so although the process actually starts, no window will be visible.

I got around this after reading the following article: http://www.codeproject.com/Articles/35773/Subverting-Vista-UAC-in-Both-32-and-64-bit-Archite

NubieJ
  • 575
  • 2
  • 9
  • 21