简体   繁体   English

添加.NET Standard 2.0类库项目后,UWP应用程序项目出错

[英]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: 在我添加到正在工作的UWP应用中后,我添加了对.NET Standard 2.0类库中成员的引用,现在,当我运行它时,出现此错误:

在此处输入图片说明

System.IO.FileNotFoundException HResult=0x80070002 Message=Could not load file or assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. System.IO.FileNotFoundException HResult = 0x80070002消息=无法加载文件或程序集“ netstandard,版本= 2.0.0.0,区域性=中性,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 Source = CameraFrames StackTrace:位于C:\\ PRIMARY \\ WORK \\ CAMERA READER \\ Samples \\ CameraFrames \\ cs \\ SOURCE \\ FrameRenderer.cs:FrameRenderer.ProcessFrame(MediaFrameReference frame),位于SDKTemplate.Scenario1_DisplayDepthColorIR.FrameReader_FrameArrivedS(MediaFrameReader ),位于C:\\ PRIMARY \\ WORK \\ CAMERA READER \\ Samples \\ CameraFrames \\ cs \\ Scenario1_DisplayDepthColorIR.xaml.cs:第315行

Here is the UWP app code that breaks it. 这是破坏它的UWP应用代码。 If I remove the "bool aa"... line, it works. 如果我删除“ bool aa” ...行,它会起作用。

        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... 这是.NET Standard 2.0类库中的代码...

    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. 我将UWP项目属性>定位>目标和最小版本均设置为Windows 10 v 1803,但仍然出错。

May the problem is from .NET framework. 可能问题出在.NET框架。

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 如果使用.NET Core 2.0,则必须将.NET框架的目标至少定为4.6.1。检查此链接中的表

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 都引用.NET标准类lib的.NET Windows窗体项目和UWP项目获得: - .NET windows forms project and UWP project that both reference .NET Standard class lib gets: 从Asp.Net 4.7项目引用.Net Standard 2.0库时出错 - Error when referencing .Net Standard 2.0 library from Asp.Net 4.7 project 将.NET Core类库引用添加到UWP应用时,显示“无法添加对项目的引用…”。 - When adding .NET Core class library reference to UWP app, it says “Unable to add a reference to project…” 从 .Net 标准类库引用 .Net Core 3.1 项目 - Referencing a .Net Core 3.1 project from a .Net Standard Class Library .NET Framework 4.7项目中的.NET标准类库 - .NET Standard Class Library in .NET Framework 4.7 project 具有NET标准2.0的引用项目的UWP(UAP 10.0.16299)出现LINQ(IEnumerable)问题 - UWP (UAP 10.0.16299) with referenced project with .Net standard 2.0 occurs problem with LINQ (IEnumerable) 在.Net标准2.0项目中添加dll参考 - Adding dll reference in .Net standard 2.0 project 我可以从 UWP 项目引用到 .NET 标准项目吗? - Can I refer from a UWP project to a .NET Standard project? 引用.NET Standard 2.0库的.NET 4.6.1项目-VSTS不会构建 - .NET 4.6.1 project referencing a .NET Standard 2.0 library - VSTS wont build UWP应用程序无法解析.NET Standard 2.0程序集 - UWP app not able to resolve .NET Standard 2.0 assembly
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM