[英]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.