Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't require targetversion to be latest for Class Libraries #2397

Closed
dotMorten opened this issue May 6, 2020 · 6 comments
Closed

Don't require targetversion to be latest for Class Libraries #2397

dotMorten opened this issue May 6, 2020 · 6 comments
Labels
no-issue-activity team-Controls Issue for the Controls team

Comments

@dotMorten
Copy link
Contributor

Describe the bug
When building a class library, the target version should not matter, as long as it's at least minversion. That check should only apply to app projects.

This check is done here and should have a condition for class libraries to ignore it (or check that target is at least minversion):

<Error
Text="Microsoft.UI.Xaml nuget package requires TargetPlatformVersion &gt;= 10.0.18362.0 (current project is $(MicrosoftUIXamlTargetPlatformCheckValue))"
Condition="$(MicrosoftUIXamlTargetPlatformCheckValue) &lt; 18362" />

Steps to reproduce the bug

  1. Create a .NET Class Library and set target version to 17134.
  2. Add WinUI nuget package.
  3. Build

Expected behavior
Build succeeds

Actual behavior
Build error:

C:\Users\username\.nuget\packages\microsoft.ui.xaml\2.3.191211002\buildTransitive\Common.targets(16,5): error : Microsoft.UI.
Xaml nuget package requires TargetPlatformVersion >= 10.0.18362.0 (current project is 17134) [E:\src\myclasslibrary.csproj]

Version Info
2.3.191211002

@msft-github-bot msft-github-bot added the needs-triage Issue needs to be triaged by the area owners label May 6, 2020
@ranjeshj
Copy link
Contributor

ranjeshj commented May 6, 2020

@jevansaks @llongley any ideas why 19H1 is required ?

@ranjeshj ranjeshj added the team-Controls Issue for the Controls team label May 6, 2020
@jevansaks
Copy link
Member

Agree that the check for class libraries could be different. This check is serving two purposes:

  1. For apps, it makes sure that you are running against a version high enough that we won't get "quirked" behavior from OS XAML.
  2. For apps and class libraries, it's trying to avoid a confusing error message down the line because the WinUI WinMDs reference types in the Windows SDK that weren't introduced until later versions of Windows.

Now for class libraries the #2 check still needs to be there, but perhaps the Windows SDK we require can be lowered?

I think if someone can suggest a fix here that covers all the various project types we would be happy to accept it.

@dotMorten is there a challenge in having your class library target the 18362 SDK?

@dotMorten
Copy link
Contributor Author

dotMorten commented May 6, 2020

is there a challenge in having your class library target the 18362 SDK?

I prefer keeping min and max version the same. This to avoid having to ensure we don't call APIs that aren't supported on that platform. If I don't need the latest features, why enable them?

I don't really get your second point. Why is it confusing to not see APIs that you can't call on the version you're targeting? It's way more confusing to see your app crash on an older PC because we called an API not available on that device.

@jevansaks
Copy link
Member

The problem is that the WinUI metadata has types it references that weren't introduced until a later version of the Windows SDK. You will get a bizarre compiler error about not being able to resolve types if you disable the check and target too old of a Windows SDK.

@ranjeshj ranjeshj removed the needs-triage Issue needs to be triaged by the area owners label May 7, 2020
@github-actions
Copy link

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@dotMorten
Copy link
Contributor Author

I’m ok with closing this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-issue-activity team-Controls Issue for the Controls team
Projects
None yet
Development

No branches or pull requests

4 participants