为帮助重现此问题,需要执行以下步骤在Visual Studio 2015中创建.NETStandard1.6 PCL:
发生以下错误:
>C:\Program Files (x86)\MSBuild\Microsoft\NuGet\Microsoft.NuGet.targets(140,5): error : Your project is not referencing the ".NETPlatform,Version=v5.0" framework. Add a reference to ".NETPlatform,Version=v5.0" in the "frameworks" section of your project.json, and then re-run NuGet restore.
以下是project.json:
{
"supports": {},
"dependencies": {
"Microsoft.NETCore.Portable.Compatibility": "1.0.1",
"NETStandard.Library": "1.6.0"
},
"frameworks": {
"netstandard1.6": {}
}
}
是否有人可以提供有关如何添加对" .NETPlatform,Version = v5.0"的引用的提示在"框架"部分?我尝试了以下方法:
" donet5.4":{}
" donet5.0":{}
都没有效果。
答案 0 :(得分:6)
对于.csproj文件末尾的VS2015,添加:
<PropertyGroup>
<NuGetTargetMoniker>.NETStandard,Version=v1.6</NuGetTargetMoniker>
</PropertyGroup>
答案 1 :(得分:0)
我遇到了同样的错误,我在project.json
"frameworks": {
"netstandard1.4": {
"imports": "portable-net45+win8+wpa81+wp8"
}
"netplatform50": {}
}
这对我有用