UWP app project gets error after addition of .NET Standard 2.0 class library project

0

After I added to my working UWP app a reference to a member in a .NET Standard 2.0 class library, that I added, now when I run it I get this error:

enter image description here

System.IO.FileNotFoundException HResult=0x80070002 Message=Could not load file or assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified. Source=CameraFrames StackTrace: at FrameRenderer.ProcessFrame(MediaFrameReference frame) in C:\PRIMARY\WORK\CAMERA READER\Samples\CameraFrames\cs\SOURCE\FrameRenderer.cs:line 393 at SDKTemplate.Scenario1_DisplayDepthColorIR.FrameReader_FrameArrived(MediaFrameReader sender, MediaFrameArrivedEventArgs args) in C:\PRIMARY\WORK\CAMERA READER\Samples\CameraFrames\cs\Scenario1_DisplayDepthColorIR.xaml.cs:line 315

Here is the UWP app code that breaks it. If I remove the "bool aa"... line, it works.

        public void ProcessFrame( MediaFrameReference frame)
    {
                       // TEST MULTI-PROJ
                       bool aa = UWP_BRIDGE_DotNet_Standard_ClassLibrary.Class1.flag;

Here is the code in the .NET Standard 2.0 class lib...

    using System;

namespace UWP_BRIDGE_DotNet_Standard_ClassLibrary
{
    public class Class1
    {
        public static bool flag = false;
        public static string buffer = "HELLO";
    }
}

I set UWP project properties > Targeting > Target & Min version both to Windows 10 v 1803 and it still errors.

c#
.net
uwp
asked on Stack Overflow Feb 4, 2019 by Doug Null

1 Answer

0

May the problem is from .NET framework.

you must target your .NET framework to 4.6.1 at least if you using .NET Core 2.0 Check the table in this link

https://docs.microsoft.com/en-us/dotnet/standard/net-standard

answered on Stack Overflow Feb 5, 2019 by AbdAlghani

User contributions licensed under CC BY-SA 3.0