'Can't create package for WinUI 3 Packaged app with plain .NET library

I have WinUI 3 Packaged app targeting .NET 6 Windows with some libraries targeting .NET 6. With Debug everything is okay, but when I want create package (Solution Explorer -> Package project -> Publish -> Create app packages...) I get error, when I can't create package, because libraries don't have target for specific .NET from package (.NET6.0-windows...). Currently I solved it with duplicated libraries targeting windows .NET, but for future development it is absolutely impractical.

Error message:

Assets file '{Path to specific project}\obj\project.assets.json' doesn't have a target for 'net6.0-windows10.0.19041.0'. Ensure that restore has run and that you have included 'net6.0-windows10.0.19041.0' in the TargetFrameworks for your project.

Is any solution for this problem?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source