Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Unable to add a reference to project – UWP to Class Library project?

A WPF project and a UWP project share the same solution. Can both projects reference a common project?

  • "Common" – .NET 6 target framework, class library
  • "UWP" – targets Windows 10 Creators Update (Build 15063)
  • "WPF App" – .NET 6 target framework, references "WPF2"
  • "WPF2" – .NET 6 target framework

The "WPF" project can reference "Common" no problem, but the "UWP" project says "Unable to add a reference to project ‘Common’".

unable to add a reference

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Annoyingly, the error message does not give a reason why.

How to use a class from one C# project with another C# project

Common controls for UWP and WPF

Reference a class library from UWP and ASP.NET 5 (solution here)

>Solution :

UWP is not compatible with .NET Core or .NET 6.

If you want to share code between a WPF app and a UWP app, your shared project should target .NET Standard 2.0.

Please refer to the docs for more information about .NET Standard and the supported .NET implementations for each version.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading