There is a C # library in the form of a dll, created for use in WinForms and WPF projects. How can it be used in UWP projects?
- Well, what does this library do? Much depends on it. For example, if it is a library with controls, then it will not work. And if the backend, then there should be no problems. - VladD
- @VlaD, no, of course this library does not contain controls. It contains a certain set of classes describing the data model. This model is not specifically designed for WinForms, WPF, or the Console. But, when I try to add it to the Reference project of the UWP, I just do not see it in the list of available libraries. But if I do specifically UWPLib - then this library appears in the lists of available - Sublihim
- Strange. And what are the dependencies of this library? - VladD
- Yes, everything that creates the studio by default. I do not use it there in addition. Here it is also necessary to clarify that the library itself does appear in the list, but when you try to add it displays a message that it could not be added. - Sublihim
- @VladD, it seems that for some reason the studio believes that UWP is a .NET Core application - Sublihim
1 answer
Indeed, various .NET platforms are not fully compatible with each other, since the main, core libraries have differences.
An ordinary build library has a specific target platform (for example, desktop .NET) and therefore will not work with UWP applications. To solve this problem, portable libraries (PCL) were invented, which can be used in several types of projects. The functionality in them, of course, is limited by the capabilities available on the target platforms.
So, let's add a portable library to our project. For this we need to find this type of project:
A dialog box appears in which you need to select the supported platforms:
Let's select in it what we need: .NET 4.5.1 (and higher), and Universal 10 (and higher). We will have a library in which to put the common classes. This library can be added to projects on desktop .NET and UWP.
Everything, it is possible to use!
- @Vladimir thanks! - Sublihim
- @Sublihim: Please! - VladD


