Can I reference the .NetStandard library from my application for Windows 10 UWP?

There are TONS posts, blogs, articles, etc .... explaining all this confusing regarding .Net / .NetCore / .NetStandard, and I read many of them.

Here is the problem, I have an application for Windows 10 UWP, and I need to refer to the library I created. At first I created the library as a NetCore library, but I could not reference it from my UWP application (which is confusing because UWP uses .Net Core, but the .Net Core kernel that I created assumed it was for ASP .NET?).

So, I tried to create the library as a PCL library and aimed only at Windows 10 UWP (which then forces you to use Windows 8.1 because they are the same). With this type of library, I’m sure I can refer to it from my UWP application, but it made me lose too many .Net namespaces that I could not get for the library.

Finally, I then selected a link in the project properties to target the .Net standard. I chose .Net Standard 1.4, and suddenly I had all the namespaces that I needed for me, and I was able to create my library. I can also successfully add it as a link to my UWP application.

However, I get the following 6 exceptions, and they don't tell me too much about the root cause, so I can fix it.

Exceptions

So, my main question is: can you reference the .Net Standard 1.4 library in your UWP application? Secondly, any ideas what these exceptions mean?

Thank!

EDIT - I uploaded both csproj files here: csproj files

+4
source share
1 answer

Well, I found this answer, but it was mainly based on this answer, which I did not see before posting my question because of the search conditions (I literally spent a day searching and tried to find the answer).

The answer that helped:

Here is a summary:

  • .NetStandard 1.4 is supported by UWP.

  • VS 2015 Update 3 UWP Microsoft.NetCore.UniversalWindowsPlatform 5.1.0. , VS 2017 , 5.1.0 . , , , ( NuGet) , VS 2015 Update 3, 5.2.3. 5.3.x, VS 2017.

  • , project.json UWP netstandard1.4. :

    "frameworks": {
      "uap10.0": {
        "imports": "netstandard1.4"
      }    
    

UWP , 6 .

, !

+2

Source: https://habr.com/ru/post/1676095/


All Articles