0

I have a .NET Standard 2.0 project which depends on another project targeting "net6.0-windows;net48". The other project uses a NET6 WindowsAPICodePack Nuget package.

When I build the solution, the other project builds fine but the depending project gets this error about WindowsAPICodePack being restored for the old .NET Framework.

Warning As Error: Package 'WindowsAPICodePack 7.0.4' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8, .NETFramework,Version=v4.8.1' instead of the project target framework '.NETStandard,Version=v2.0'. This package may not be fully compatible with your project.

enter image description here

How can I force it to restore the package for .NET6/Standard2.0?

Val
  • 1,548
  • 1
  • 20
  • 36
  • Just the obvious reason: you can't have a .netstandard project that depends on a library that isn't standard. – Hans Passant Mar 08 '23 at 14:51
  • So what should I do? Change the dependent project's target framwork (the project which references WindowsAPICodePack) to .NET Standard 2.0? – Val Mar 08 '23 at 15:15
  • No, that is what you already have, don't you? You need to change the dependent project's target framework (the project which references the WindowsAPICodePack) to a TFM that WindowsAPICodePack [supports](https://www.nuget.org/packages/WindowsAPICodePack#dependencies-body-tab). – Christian.K Mar 08 '23 at 16:21
  • The project referencing WindowsAPICodePack targets .NET6. I see WindowsAPICodePack supports .NET6: https://www.nuget.org/packages/WindowsAPICodePack#supportedframeworks-body-tab – Val Mar 08 '23 at 19:04

0 Answers0