How to trigger a desktop process from sideloaded Windows Store Apps–the easy way using the brand new Visual Studio Templates

This posting is a follow up posting to my article on how to Trigger Desktop processes from Windows Store Apps. The last article was lengthy, but the result was correct. In the meantime you can download Templates for Visual Studio in the Visual Studio Gallery that make your life very easy when you try to achieve the same Thing. No Need for 50 steps, when you can do it in 14.

Basically  you can find a description on the downloadpage of the templates . Let’s go a little more into detail, to make sure it does work for you.

How To

1. Download &  install the templates. Restart VS afterwards.

2. Start VS as Admin. This will make your life very easy!

3. Create a solution containing 4 Projects in Visual Studio. A Windows Store App project based on the C# Template, a Classic C# Library, a Brokered Windows Runtime Component Project and a Brokered Windows Runtime Component Proxy.

4. Reference the Classic Library Project from your Broker Project.

5. Reference the Broker Project from the Proxy Project.

6. Reference the Proxy Project from the App Project.

7. Open the Settings of the Proxy Project and select Linker/General/Register Output –> YES. That’s why we started VS as admin!

8. Open the app manifest in the code Editor and add the following lines (you can put it right before the closign </Package> tag.

<Extension Category="windows.activatableClass.inProcessServer">
<ActivatableClassAttribute Name="DesktopApplicationPath" Type="string"
Value="C:\Users\YOU\Documents\visual studio 2013\
Projects\bwrc\bwrc\bin\Debug" />

9.  Make sure you edit the path end ActivatableClassId correctly, depending on where the Output of the brokered component can be found and depending on the fully qualified class of the brokered component. For Debug purposes this will be the debug Folder. In production you will need another location! You just have to specify it.

10. Good News! You are basically done. To get this app to life, you could do stuff like:

11. Create a public method in ClassicLibrary:

namespace ClassLibrary1
public class Class1
public int RunCmdFromClassic()
System.Diagnostics.Process proc = new System.Diagnostics.Process();
var cmd = "xcopy";
System.Diagnostics.Process.Start("CMD.exe", cmd);
return 42;

11. Create a public method in the Broker that creates an instance of the classic class and Triggers the RunCMD Method. 

namespace BrokeredWindowsRuntimeComponent1
public sealed class Class
public int DoIt()
ClassLibrary1.Class1 cla = new ClassLibrary1.Class1();
return 42;
12. Create a button in the mainpage of the app.
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Button Content="Click" Click="Button_Click"

13. Add an Eventhandler that Triggers the brokered component.
private void Button_Click(object sender, RoutedEventArgs e)
BrokeredWindowsRuntimeComponent1.Class cla =
new BrokeredWindowsRuntimeComponent1.Class();
theButton.Content = cla.DoIt().ToString();

14. Now let it run! Click the button and – it works! The result will look like this with the cmd opening up just once.

Comments (1)

  1. Palash Debnath sagt:


    Thanks for your article. It helped a lot. But I was not able to execute the System.Diagnostics.Process.Start("CMD.exe", cmd);

    It always gives me an unknown error. Are you familiar about anything related to this.

Skip to main content