[英]UWP application and .NET Core RC2: cannot reference netstandard1.4 packages
我有一個場景,我使用共享代碼庫運行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 [...]"
錯誤。
經過一些環顧四周,我試圖找出問題並發現我甚至無法添加對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).
我有一個最小的解決方案來重現上傳到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"
},
注意:我將Microsoft.NETCore.UniversalWindowsPlatform更新到最新版本。 我添加了NETStandard.Library和Microsoft.NETCore.Platforms。
非常感謝幫助! 提前謝謝 - 西蒙
UWP目前不支持System.IO.FileSystem.Watcher。 現代SDK不公開我們需要實現它的底層Windows API(ReadDirectoryChanges)。
-Eric,.NET團隊
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.