The following forum(s) have migrated to Microsoft Q&A (Preview): Developing Universal Windows apps!
Visit Microsoft Q&A (Preview) to post new questions.

Learn More

How to call ProjectionManager StartProjectingAsync to mirror device desktop from .Net Console app RRS feed

  • Question

  • How can I use the ProjectionManager.StartProjectingAsync to just start mirroring the current desktop.

    The sample in
    Doesn't really do what I want. I don't want to create any new windows etc.

    Just project the desktop nothing else.

    I want the projection PC to show exactly what is on main PC.

    This works fine if the projection is started from Windows with:

    start explorer.exe ms-settings-connectabledevices:devicediscovery

    But that means having to show Windows UI and have user select the projector etc.

    I want to do this automatically and show no windows UI and using .Net Framework

    So far I got this C# console app (see below) 

    It works but it means I have to ignore an exception:

    Name Value Type
    ex.Message "Catastrophic failure\r\n\r\nCatastrophic failure\r\n" string

    But the projection is still started and it works even if I pass in 0 and 0

    It is ugly but works.
    Does anyone have a better solution?
    Also it would be nice to be able to disconnect as well.


    using System;
    using System.Threading.Tasks;
    using Windows.Devices.Enumeration;
    using Windows.UI.ViewManagement;

    namespace StartProj
        class Program
            static void Main(string[] args)
                //Pass in the name of the PC that we like to project to
                if(args.Length > 0)
            private static async Task GetProjector(string name)
                    //Get list of available projectors
                    var projectorSelectorQuery = ProjectionManager.GetDeviceSelector();
                    var outputDevices = await DeviceInformation.FindAllAsync(projectorSelectorQuery);
                    // Loop through all devices and find match
                    for (int i = 0; i < outputDevices.Count; i++)
                        var device = outputDevices[i];
                        if(device.Name == name)
                                //Start projector for device
                                await ProjectionManager.StartProjectingAsync(0, 0, device);
                            catch(Exception ex)
                                //Ignore this exception
                catch (Exception e)


    Friday, October 18, 2019 4:58 AM

All replies

  • ProjectionManager  method is used to project uwp app views to multiple monitor. For console app, please post this case to related  forum.

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact

    Friday, October 18, 2019 1:55 PM
  • Can you show a similar example with UWP app, without opening new windows?
    As "
    Projection" project  sample in

    Basically what I like to find out if how to call ProjectionManager.StartProjectingAsync and only project the current desktop. Just like the  

    start explorer.exe ms-settings-connectabledevices:devicediscovery does.
    I don't want any new windows to pop up etc.
    Just duplicate PC1 screen to PC2 screen
    So it makes no sense to set 

    Just the 

    That is what I an showing in the code above.

    Also what exactly is causing the "Catastrophic failure"

    The screen projection starts fine, what is the problem really? 

    Friday, October 18, 2019 3:08 PM