![](/img/trans.png)
[英]dotnet restore fail “Unable to resolve 'PCLLibrary' for '.NETCoreApp,Version=v1.0'.”
[英]Microsoft.Composition 1.0.27 incompatible with .NETCoreApp,Version=v1.0
在新項目上進行發布時遇到此錯誤。 使用.Net 4.52作為某些較舊軟件包(主要是Paypal)的主要框架
我已經閱讀了框架中使用“導入”部分的許多其他文章,但這對解決這個問題沒有幫助。
錯誤信息:
軟件包Microsoft.Composition 1.0.27與netcoreapp1.0(.NETCoreApp,Version = v1.0)不兼容。
軟件包Microsoft.Composition 1.0.27支持:Portable-net45 + win8 + wp8 + wpa81(.NETPortable,Version = v0.0,Profile = Profile259)
傑森計划:
"dependencies": {
"BundlerMinifier.Core": "2.2.306",
"MailKit": "1.10.2",
"Microsoft.AspNetCore.Authentication.Cookies": "1.1.0",
"Microsoft.AspNetCore.Diagnostics": "1.1.0",
"Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore": "1.1.0",
"Microsoft.AspNetCore.Identity.EntityFrameworkCore": "1.1.0",
"Microsoft.AspNetCore.Mvc": "1.1.1",
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.1.0",
"Microsoft.AspNetCore.Http.Features": "1.1.0",
"Microsoft.AspNetCore.StaticFiles": "1.1.0",
"Microsoft.EntityFrameworkCore.SqlServer": "1.1.0",
"Microsoft.EntityFrameworkCore.SqlServer.Design": "1.1.0",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.1.0",
"Microsoft.Extensions.Configuration.Json": "1.1.0",
"Microsoft.Extensions.Configuration.UserSecrets": "1.1.0",
"Microsoft.Extensions.Logging": "1.1.0",
"Microsoft.Extensions.Logging.Console": "1.1.0",
"Microsoft.Extensions.Logging.Debug": "1.1.0",
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.1.0",
"Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.1.0",
"PayPal": "1.8.0",
"Microsoft.AspNetCore.Http": "1.1.0",
"Microsoft.VisualStudio.Web.CodeGenerators.Mvc": "1.1.0-preview4-final",
"Microsoft.VisualStudio.Web.CodeGeneration.Tools": "1.1.0-preview4-final",
"Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview2-final",
"Microsoft.AspNetCore.Session": "1.0.0"
},
"tools": {
"BundlerMinifier.Core": "2.2.281",
"Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview2-final",
"Microsoft.VisualStudio.Web.CodeGenerators.Mvc": "1.1.0-msbuild3-final",
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.1.0-preview4-final",
"Microsoft.VisualStudio.Web.CodeGeneration.Tools": "1.1.0-preview4-final"
},
"frameworks": {
"net452": {
"imports": [ "dnxcore50", "portable-net45+win8" ]
}
},
"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true
},
"publishOptions": {
"include": [
"wwwroot",
"Views",
"Areas/**/Views",
"appsettings.json",
"web.config"
]
},
"scripts": {
"prepublish": [ "bower install", "dotnet bundle" ],
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
}
使用以下內容編輯project.JSON解決了我的問題:
"dependencies": {
"BundlerMinifier.Core": {
"version": "2.2.281",
"type": "build",
"imports": [ "portable-net45+win8+wp8+wpa81" ]
},
"MailKit": "1.10.2",
"Microsoft.AspNetCore.Authentication.Cookies": "1.1.0",
"Microsoft.AspNetCore.Diagnostics": "1.1.0",
"Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore": "1.1.0",
"Microsoft.AspNetCore.Identity.EntityFrameworkCore": "1.1.0",
"Microsoft.AspNetCore.Mvc": "1.1.1",
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.1.0",
"Microsoft.AspNetCore.Http.Features": "1.1.0",
"Microsoft.AspNetCore.StaticFiles": "1.1.0",
"Microsoft.EntityFrameworkCore.SqlServer": "1.1.0",
"Microsoft.EntityFrameworkCore.SqlServer.Design": "1.1.0",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.1.0",
"Microsoft.Extensions.Configuration.Json": "1.1.0",
"Microsoft.Extensions.Configuration.UserSecrets": "1.1.0",
"Microsoft.Extensions.Logging": "1.1.0",
"Microsoft.Extensions.Logging.Console": "1.1.0",
"Microsoft.Extensions.Logging.Debug": "1.1.0",
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.1.0",
"Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.1.0",
"Microsoft.AspNetCore.Http": "1.1.0",
"Microsoft.VisualStudio.Web.CodeGenerators.Mvc": {
"version": "1.1.0-msbuild3-final",
"type": "build",
"imports": [ "portable-net45+win8+wp8+wpa81" ]
},
"Microsoft.VisualStudio.Web.CodeGeneration.Tools": {
"version": "1.1.0-preview4-final",
"type": "build",
"imports": [ "portable-net45+win8+wp8+wpa81" ]
},
"Microsoft.EntityFrameworkCore.Tools": {
"version": "1.0.0-preview2-final",
"type": "build",
"imports": [ "portable-net45+win8+wp8+wpa81" ]
},
"Microsoft.AspNetCore.Session": "1.0.0",
"PayPal": "1.8.0"
},
"tools": {
"BundlerMinifier.Core": {
"version": "2.2.281",
"type": "build",
"imports": [ "portable-net45+win8+wp8+wpa81" ]
},
"Microsoft.EntityFrameworkCore.Tools": {
"version": "1.0.0-preview2-final",
"type": "build",
"imports": [ "portable-net45+win8+wp8+wpa81" ]
},
"Microsoft.VisualStudio.Web.CodeGenerators.Mvc": {
"version": "1.1.0-msbuild3-final",
"type": "build",
"imports": [ "portable-net45+win8+wp8+wpa81" ]
},
"Microsoft.AspNetCore.Server.IISIntegration.Tools": {
"version": "1.1.0-preview4-final",
"type": "build",
"imports": [ "portable-net45+win8+wp8+wpa81" ]
},
"Microsoft.VisualStudio.Web.CodeGeneration.Tools": {
"version": "1.1.0-preview4-final",
"type": "build",
"imports": [ "portable-net45+win8+wp8+wpa81" ]
}
},
"frameworks": {
"net452": {
"imports": [ "dnxcore50", "portable-net45+win8+wp8+wpa81" ]
}
},
"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true
},
"publishOptions": {
"include": [
"wwwroot",
"Views",
"Areas/**/Views",
"appsettings.json",
"web.config"
]
},
"scripts": {
"prepublish": [ "bower install", "dotnet bundle" ],
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
}
該消息准確地描述了問題。 您的項目針對的是.Net Core 1.0,並且該軟件包與之不兼容。
發生這種情況是因為並非所有.Net平台和版本都兼容。 例如,.Net Core 1.0僅與.Net Standard 1.6兼容。 本頁顯示具有不同.Net平台之間兼容性的表。
在這種情況下,您的目標是.Net Core 1.0,而軟件包的目標是4.5。 如表中所示,它們不兼容。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.