UWP 应用程序和 .NET Core RC2:无法引用 netstandard1.4 包 [英] UWP application and .NET Core RC2: cannot reference netstandard1.4 packages

查看:31
本文介绍了UWP 应用程序和 .NET Core RC2:无法引用 netstandard1.4 包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个场景,我使用共享代码库运行 UWP 客户端应用程序、UWP IOT 应用程序和 .NET Core 应用程序.在 .NET Core RC1 中,我构建了一个类库(包)并使用dotnet5.4"作为该库的基础框架.

I have a scenario where I run a UWP client application, a UWP IOT application and a .NET Core application using a shared code base. In .NET Core RC1 I built a Class Library (Package) and used "dotnet5.4" as the base framework for that library.

使用生成构建输出",我可以从 .NET Core 应用程序(控制台)引用创建的 nuget 包并使用解决方法(从 %local%.dnx 复制包 -> %local%.nuget)UWP 应用程序也能够参考和使用该包.

Using "generate build output" I could reference the created nuget packages from the .NET Core application (console) and using a workaround (copy the packages from %local%.dnx -> %local%.nuget) the UWP applications were able to reference and use the package as well.

现在在 RC2 中,事情发生了一些变化,我再次能够使用升级后的库(项目文件中的工具升级,对 project.json、netstandard1.4 的更改(因为根据 this)) 完美使用 .NET Core 控制台应用程序.

Now in RC2 things have changed a bit and I am again able to consume the upgraded library (tooling upgraded in project file, changes to project.json, netstandard1.4 (since 1.5 does not work with UAP10 according to this)) perfectly using the .NET Core console application.

对于 UWP,我无法添加库,因为我得到了许多臭名昭著的库

For UWP I cannot add the library since I get dozens of infamous

"[...] provides a compile-time reference assembly [...] but there is no run-time assembly compatible with [...]"

错误.

环顾四周后,我试图隔离问题,发现我什至无法添加对 System.IO.FileSystem.Watcher 的引用,原因是:

After some looking around, I tried to isolate the issue and found out that I can't even add a reference to System.IO.FileSystem.Watcher due to:

System.IO.FileSystem.Watcher 4.0.0-rc2-24027 provides a compile-time reference assembly for System.IO.FileSystem.Watcher on UAP,Version=v10.0, but there is no run-time assembly compatible with win10-arm-aot.
Some packages are not compatible with UAP,Version=v10.0 (win10-x64-aot).
System.IO.FileSystem.Watcher 4.0.0-rc2-24027 provides a compile-time reference assembly for System.IO.FileSystem.Watcher on UAP,Version=v10.0, but there is no run-time assembly compatible with win10-x64.
Some packages are not compatible with UAP,Version=v10.0 (win10-arm).
Some packages are not compatible with UAP,Version=v10.0 (win10-x86-aot).
System.IO.FileSystem.Watcher 4.0.0-rc2-24027 provides a compile-time reference assembly for System.IO.FileSystem.Watcher on UAP,Version=v10.0, but there is no run-time assembly compatible with win10-x86.
System.IO.FileSystem.Watcher 4.0.0-rc2-24027 provides a compile-time reference assembly for System.IO.FileSystem.Watcher on UAP,Version=v10.0, but there is no run-time assembly compatible with win10-x86-aot.
System.IO.FileSystem.Watcher 4.0.0-rc2-24027 provides a compile-time reference assembly for System.IO.FileSystem.Watcher on UAP,Version=v10.0, but there is no run-time assembly compatible with win10-arm.
Some packages are not compatible with UAP,Version=v10.0 (win10-x64).
System.IO.FileSystem.Watcher 4.0.0-rc2-24027 provides a compile-time reference assembly for System.IO.FileSystem.Watcher on UAP,Version=v10.0, but there is no run-time assembly compatible with win10-x64-aot.
Some packages are not compatible with UAP,Version=v10.0 (win10-x86).
Some packages are not compatible with UAP,Version=v10.0 (win10-arm-aot).

我有一个最小的解决方案来重现上传到OneDrive的问题.

I have a minimal solution to reproduce the issue uploaded to OneDrive.

除了 project.json 中的依赖项外,我没有对空白的 UWP 模板进行任何更改:

I made no changes to the blank UWP template except for the dependencies in project.json:

"dependencies":
{
    "Microsoft.ApplicationInsights": "2.1.0-beta4",
    "Microsoft.ApplicationInsights.PersistenceChannel": "2.0.0-beta3",
    "Microsoft.ApplicationInsights.WindowsApps": "1.1.1",
    "Microsoft.NETCore.Platforms": "1.0.1-rc2-24027",
    "Microsoft.NETCore.UniversalWindowsPlatform": "5.1.0",
    "NETStandard.Library": "1.5.0-rc2-24027",

    "System.IO.FileSystem.Watcher": "4.0.0-rc2-24027"
},

注意:我将 Microsoft.NETCore.UniversalWindowsPlatform 更新到最新版本.我添加了 NETStandard.Library 和 Microsoft.NETCore.Platforms.

Note: I updated Microsoft.NETCore.UniversalWindowsPlatform to the latest version. I added NETStandard.Library and Microsoft.NETCore.Platforms.

非常感谢帮助!提前致谢-西蒙

Help is greatly appreciated! Thanks in advance -Simon

推荐答案

System.IO.FileSystem.Watcher 目前在 UWP 中不受支持.现代 SDK 没有公开我们需要实现它的底层 Windows API (ReadDirectoryChanges).

System.IO.FileSystem.Watcher isn't currently supported in UWP. The modern SDK doesn't expose the underlying windows API (ReadDirectoryChanges) that we need to implement it.

-Eric,.NET 团队

-Eric, .NET team

这篇关于UWP 应用程序和 .NET Core RC2:无法引用 netstandard1.4 包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆