Don't require targetversion to be latest for Class Libraries
See original GitHub issueDescribe 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): https://github.com/microsoft/microsoft-ui-xaml/blob/8f8cd0fe32754cfcd83dafb2fc8539703b6aec26/build/NuSpecs/MUXControls-Nuget-Common.targets#L16-L18
Steps to reproduce the bug
- Create a .NET Class Library and set target version to 17134.
- Add WinUI nuget package.
- 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
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (5 by maintainers)
Top Results From Across the Web
Target frameworks in SDK-style projects - .NET
An app or library can target a version of .NET Standard. .NET Standard versions represent standardized sets of APIs across all .
Read more >Changing target framework of class library
I have a class library that currently targets .Net Standard 2.1. When I created the project, I had set it to 2.1 not...
Read more >Targeted .NET Frameworks - Visual Studio (Windows)
NET Framework that you want your project to target so the application can only use functionality that's available in the specified version.
Read more >Support Multiple Versions of .NET From A Single Class ...
This element describes what version of .NET the compiled DLL will support (or “target”) in the preceding example this is .NET 6.0. The...
Read more >Swift Package Manager
Library. Use a library product to vend library targets. This makes a target's public APIs available to clients that integrate the Swift package....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.
I’m ok with closing this