Reputation: 94279
I just built one of the project templates Visual Studio 2012 offers (the 'Split App (XAML)' template accessible via Templates -> Other Languages -> Visual C# -> Windows Store in the 'New Project' dialog).
I can execute the application from Visual Studio 2012, and I can launch it from the Windows 8 start screen - but if I attempt to launch the generated executable directly (e.g. via the Windows explorer or from a command shell), a full-screen error message is printed saying "This app can't run on your PC".
Looking at a running instance of the application via Process Explorer shows that it a) just links against the .NET runtime MSCOREE.DLL and b) it gets invoked with a command line like this:
"[..] \bin\Debug\AppX\WindowsStoreSample.exe" -ServerName:App.AppXgsxd2athqtr03f55we0938hcn632we3k.mca
My actual question is: what's the correct way to launch this kind of application programmatically? Would I use plain CreateProcess
and then try to assemble a command line like shown above? If so, how could I determine the correct -ServerName
argument? Or is there some other way to launch such applications?
Upvotes: 2
Views: 3261
Reputation: 94279
The correct way to launch Windows Store apps is to use the IApplicationActivationManager
interface. This is also what Visual Studio itself uses for launching the application. All methods on the interface have a DWORD
out parameter which gets you the PID of the newly launched process.
Upvotes: 3