安裝我有以下project.json
.NET核心項目:.NETStandard庫NuGet包 - 無法在標準項目
{
"version": "1.0.0-*",
"dependencies": {
"NETStandard.Library": "1.6.0"
},
"frameworks": {
"netstandard1.6": {
"imports": "dnxcore50"
}
},
"scripts": {
"postcompile": [
"dotnet pack --no-build --configuration %compile:Configuration%"
]
}
}
我已經創建NuGet包(見上postcompile
),並發表在的NuGet。
然後我創建了標準4.6.2庫,但無法安裝包 - 出現錯誤,該包不包含用於目標.NET Framework 4.6.2的有效程序集。
我應該如何準備nuget包以使其在標準庫中可用?我認爲NETStandard對於核心和標準項目都是有效的。
nope。你必須在你的nuget包中添加target-framework-support。將net462添加到你的project.json中 –
它可能與postcompile?在文檔中https://docs.microsoft.com/zh-cn/dotnet/articles/core/tools/dotnet-pack沒有這樣的選項。 – pwas
將targetframework net462添加到project.json中。後編譯它是不可能的。添加目標框架後,您的軟件包將獲得支持。 (有net462和netstandard1.6之間的代碼/庫差異) –