UWP应用程序和.NET Core RC2:不能引用netstandard1.4软件包

Sim*_*tes 11 .net c# dnx windows-10-iot-core uwp

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

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

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

对于UWP我无法添加库,因为我得到了几十个臭名昭着的

"[...] provides a compile-time reference assembly [...] but there is no run-time assembly compatible with [...]"
Run Code Online (Sandbox Code Playgroud)

错误.

经过一些环顾四周,我试图找出问题并发现我甚至无法添加对System.IO.FileSystem.Watcher的引用,原因如下:

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).
Run Code Online (Sandbox Code Playgroud)

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

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

"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"
},
Run Code Online (Sandbox Code Playgroud)

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

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

The*_*ESJ 2

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

-Eric,.NET 团队