Sdk: Cannot target uap10.0 apps with new TargetFrameworks syntax

Created on 13 Jul 2017  路  20Comments  路  Source: dotnet/sdk

Forgive me if this is already formally bugged somewhere, but while I've seen lots of references to uap10 targeting issues, I didn't come across an issues that specifically addressed <targetframeworks> support.

While in general the documentation for TargetFrameworks and the new .csproj format seems to be, shall we say, on the skimpier side; I'm unable to devise whether or not - in theory - targeting UAP10.0 should work in a multi-targeted csproj.

I know UWP/UAP support is a bit of a thorn in the side of the dotnet sdk and corefx teams, but it's very unclear as to how exactly it fits in to the picture.

A .NET library created with <TargetFrameworks>netstandard1.3</TargetFrameworks> can be consumed by a "legacy" UWP/UAP10 project, but there does not seem to be a way of creating a multi-targeted .NET library that includes a dependency on UWP.

Either UWP is a framework target, in which case <TargetFrameworks>uap10.0</TargetFrameworks> should work, or UWP is a .NET Standard target w/ access to Windows-specific and platform-specific libraries (which is what is most-heavily implied in the .NET Standard documentation). However, functionally that does not seem to be the case since a .NET Standard library (<TargetFrameworks>netstandard1.3</TargetFrameworks>) cannot install microsoft.netcore.universalwindowsplatform as a dependency.

We're left in a limbo state where it seems projects targeting UAP/UWP must use the legacy csproj format, because they're neither full-fledged framework targets nor do they have .NET Standard-compliant libraries.

Most helpful comment

yep sure - https://github.com/MvvmCross/MvvmCross/blob/23819a3ce1c3846c9d0307f935a18ef4657f51eb/MvvmCross/MvvmCross.csproj#L3
Also, I have a walk through for setting it up on a class library for use with Uno here:
https://nicksnettravels.builttoroam.com/uno-crossplatform-template
The support for WASM is essentially just a .NET standard library. And yes, you do need to use https://github.com/novotnyllc/MSBuildSdkExtras

All 20 comments

UWP project can use new csproj format... see here

Any feedback on this? This is causing issues building multi-targetted class libraries where VS reports that the target framework is incorrect. Doesn't seem to matter whether you specify uap10.0 or uap10.0.XXXX

I guess this is directly related to this issue:
https://github.com/dotnet/sdk/issues/491

A workaround to multitarget with UWP as a target would be to use Oren's SDK Extras:
https://github.com/onovotny/MSBuildSdkExtras

RIght now, the MSBuildSdkExtras is the only way to make this work, as suggested above. This is not natively supported in the SDK.

@livarcocc is there an intention to support it in the future, or has that not been decided?

Why is this closed? Has it been decided that this will never be supported?

Is the official support planned and when should we expect it?

@dsplaisted do you know if there is any plan to support uap in TargetFrameworks?

No plans at the moment to support this.

@livarcocc what is hapening with this? Why won't it be supported?

Has the situation changed with net5?

@mqudsi I would have to guess that the intention is to never allow targeting of this framework. My guess is that we will have to wait for WinUI on top of .NET 5 / 6.

This issue is frustrating. Please fix this.
UWP/WinUI is one of the top engineering masterpieces of MS. Yet, it's unfortuantely on the bottom of the priority list.

@weitzhandler tell me about it! I've had to separately target UWP throughout my library. This should be fixed when .NET 5 is rolled out to all the platforms but there is no telling when that will happen.

As noted up thread, there is an SDK you can use which helps with this: https://github.com/novotnyllc/MSBuildSdkExtras

@dsplaisted I've tried using that and got nowhere

@MelbourneDeveloper UWP is definitely supported in multi-targeting, which from what I can tell is what you're trying to do with your library. What's not supported for UWP, Android, iOS, macOS is the new style sdk project for the head projects (ie the runnable application). This will of course need to be fixed in Maui timeframe (18mths or so).

@nickrandolph are you able to point me to a sample csproj that targets both .NET Standard and UWP?

yep sure - https://github.com/MvvmCross/MvvmCross/blob/23819a3ce1c3846c9d0307f935a18ef4657f51eb/MvvmCross/MvvmCross.csproj#L3
Also, I have a walk through for setting it up on a class library for use with Uno here:
https://nicksnettravels.builttoroam.com/uno-crossplatform-template
The support for WASM is essentially just a .NET standard library. And yes, you do need to use https://github.com/novotnyllc/MSBuildSdkExtras

@nickrandolph brilliant. Thanks.

Was this page helpful?
0 / 5 - 0 ratings