简体   繁体   中英

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

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:

在此处输入图片说明

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM