When you create a UWP application find the file called Package.appxmanifest open it with notepad, and by default under Dependencies you should see this:
<Dependencies> <TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.0.0" MaxVersionTested="10.0.0.0" /> </Dependencies>
Which is probably topically what you would want to, which is to have TargetDeviceFamily Name="Windows.Universal" which means that it targets all of the Windows 10 devices!
However in my case I just want to target the desktop app, thus I need to set TargetDeviceFamily Name to Windows.Desktop as follow:
<Dependencies> <!--<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.0.0" MaxVersionTested="10.0.0.0" />--> <TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.0.0" MaxVersionTested="10.0.0.0" /> </Dependencies>
And there you have it.
Targeting different platform type:
Here are the different Names that you can set TargetDeviceFamily, so that it only works on:
- Mobile
<Dependencies> <TargetDeviceFamily Name="Windows.Mobile" MinVersion="10.0.0.0" MaxVersionTested="10.0.0.0" /> </Dependencies>
- Desktop
<Dependencies> <TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.0.0" MaxVersionTested="10.0.0.0" /> </Dependencies>
- Xbox
<Dependencies> <TargetDeviceFamily Name="Windows.Xbox" MinVersion="10.0.0.0" MaxVersionTested="10.0.0.0" /> </Dependencies>
- Iot
<Dependencies> <TargetDeviceFamily Name="Windows.Iot" MinVersion="10.0.0.0" MaxVersionTested="10.0.0.0" /> </Dependencies>
Good luck,
Msdn reference: https://msdn.microsoft.com/en-us/library/windows/apps/dn986903.aspx