UWP application and .NET Core RC2: cannot reference netstandard1.4 packages

岁酱吖の 提交于 2019-12-03 07:28:23

问题


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.

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.

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.

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

errors.

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).

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

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"
},

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


回答1:


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 team



来源:https://stackoverflow.com/questions/37365216/uwp-application-and-net-core-rc2-cannot-reference-netstandard1-4-packages

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!