question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Don't require targetversion to be latest for Class Libraries

See original GitHub issue

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): https://github.com/microsoft/microsoft-ui-xaml/blob/8f8cd0fe32754cfcd83dafb2fc8539703b6aec26/build/NuSpecs/MUXControls-Nuget-Common.targets#L16-L18

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

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
jevansakscommented, May 6, 2020

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.

0reactions
dotMortencommented, Jul 29, 2023

I’m ok with closing this

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found