![](/img/trans.png)
[英]warning NU1701: Package 'System.Linq.Queryable 4.0.1' was restored using '.NETFramework,V ersion=v4.6.1' instead of the project target framework
[英]In my .Net Core 2.0 project, .Net FW package is used instead of .Net Standard (warning NU1701)
我在我的.Net Core 1.0項目中使用了nuget包sqlite-net-pcl ,它沒有任何問題(使用了.Net Standard 1.1版本的軟件包)。 現在,我將此項目升級到.Net Core 2.0,然后我突然收到這些構建警告:
1>C:\Projects\Project.csproj : warning NU1701: Package 'SQLitePCLRaw.lib.e_sqlite3.linux 1.1.5' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETCoreApp,Version=v2.0'. This package may not be fully compatible with your project.
1>C:\Projects\Project.csproj : warning NU1701: Package 'SQLitePCLRaw.lib.e_sqlite3.osx 1.1.5' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETCoreApp,Version=v2.0'. This package may not be fully compatible with your project.
1>C:\Projects\Project.csproj : warning NU1701: Package 'SQLitePCLRaw.lib.e_sqlite3.v110_xp 1.1.5' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETCoreApp,Version=v2.0'. This package may not be fully compatible with your project.
顯然,我的.Net Core 2.0項目現在正在使用.Net Framework 4.6.1版本的nuget包,即使有.Net Standard 1.1版本可用。 我知道使用.Net Core 2.0這是可能的,但我也知道,由於兼容性原因,這並不總是有效,所以為什么不能只使用實際可行的.Net Standard 1.1版本,我該怎么辦?強制消除警告?
看起來這非常特定於依賴包SQLitePCLRaw.lib.esqlite3.*
的版本,它們是SQLitePCLRaw.bundle_green
/ sqlite-net-pcl
的.NET Core / .NET標准片的傳遞依賴性。 這可能也是這些軟件包的1.1.5
版本所特有的,因為最新版本( 1.1.8
)的編寫方式不同以表示支持的平台 - 1.1.5
軟件包不包含lib
文件夾,只包含runtimes
文件夾和沒有依賴關系組,因此NuGet對支持的框架感到困惑,並假設該軟件包是為.NET Framework編寫的。 較新的版本通過為包含虛擬_._
文件的受支持框架提供包含子文件夾的lib
文件夾來解決此問題。
如果您想確保在依賴關系圖中只有明確支持.NET Standard或.NET Core的軟件包(無論您的項目目標是什么),您可以將其添加到項目文件中:
<PropertyGroup>
<DisableImplicitAssetTargetFallback>true</DisableImplicitAssetTargetFallback>
</PropertyGroup>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.