我正在使用 VS 中的新“类库(包)”模板之一创建 NuGet 包。我想知道,有什么方法可以使用 PCL 中的包吗?not使用.NET Core?
例如,我有一个包裹,Enu
,具有以下project.json
:
{
"title": "Enu",
// project details...
"dependencies": {
"System.Runtime": "4.0.0"
},
"frameworks": {
"dotnet": { }
}
}
然后我有一个针对 .NET 4.5、Windows 8 和 Windows 8.1 的旧版 PCL。当我尝试通过安装包时Install-Package Enu
,我收到以下错误:
PM> Install-Package Enu
# blah blah blah
Install-Package : Could not install package 'Enu 4.0.0'. You are trying to install this package into a project that targets '.NETPortable,Version=v4.5,Profile=Profile111', but the package does not contain
any assembly references or content files that are compatible with that framework. For more information, contact the package author.
我可以做什么来解决这个问题?
note:奇怪的是,它可以在控制台应用程序上运行。
是的,这是可能的。这是一个很好的参考图(摘自here http://oren.codes/2015/06/09/pcls-net-core-dnx-and-uwp/):
tl;dr要针对所有内容,请将其添加到您的project.json
:
"frameworks": {
"dotnet": { }, // .NET 4.6 and DNX
"net45": { }, // .NET Framework 4.5
"netcore45": { } // WinRT and Silverlight
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)