UWP app targeted only to Desktop/Tablet?

2019-09-10 19:16发布

问题:

I'm trying to understand how UWP apps work. I'm looking at some third party libraries on NuGet, but some of them won't work with UWP due, I presume to missing dependencies.

For example, some PDF drawers need System.Drawing.dll which I presume may not be accessible on Windows Phone.

Given my app doesn't need to work on Phones, and it's arguably not even required for tablets... it's primarily a Desktop app... how can I get around these dependency issues?

Is there some way for me to still use these third party libraries; perhaps by choosing a setting to say not to target Windows Phone at all?

回答1:

To reduce your confusion I will try to provide straight information:

1) When developing UWP application you can define which Device Family you would like to support. You can do it in the app manifest - provide the information that you support only Desktop family:

<Dependencies>
 <TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.0.0" MaxVersionTested="10.0.0.0" />
</Dependencies>

This is very helpful link: https://msdn.microsoft.com/library/windows/apps/dn986903

There you can find the information how to support different device families: For instance for Mobile and Desktop you can put:

<Dependencies>
 <TargetDeviceFamily Name="Windows.Mobile" MinVersion="10.0.x.0" MaxVersionTested="10.0.y.0"/>
 <TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.x.0" MaxVersionTested="10.0.y.0"/>
</Dependencies>

Second very important thing is that when you plan not support any mobile devices you do not have to create additional packages for the ARM architecture:

Last operation that you can do is to configure "Pricing and availability" in the Windows Store section when publishing your app:

Hope this will help.



回答2:

If I understood your question right, you're looking at building the UWP app specifically for certain targets (say desktops or mobile?)

Take a look at the TargetDeviceFamily configuration on your package manifest (Documentation here: link)

Also, check out this answer: Change what devices a UWP app targets