首页 新闻 会员 周边

使用VS2017新建的Web项目报错:Package Microsoft.Composition 1.0.27 is not compatible with netcoreapp1.1

1
[已解决问题] 解决于 2017-03-20 10:03

使用VS2017新建的Web项目报错:

看到这样的错误提示,毫无意义。赶脚这应该是VS2017的BUG,没有显示错误的位置。于是用dotnet restore手动还原,结果在控制台中终于显示了详细的错误:

C:\Program Files\dotnet\sdk\1.0.0\NuGet.targets(97,5): error : Package Microsoft.Composition 1.0.27 is not compatible with netcoreapp1.1 (.NETCoreApp,Version=v1.1). Package Microsoft.Composition 1.0.27 supports: portable-net45+win8+wp8+wpa81 (.NETPortable,Version=v0.0,Profile=Profile259) [C:\Users\username\Documents\Admin.Web.Tests\Admin.Web.Tests.csproj]
C:\Program Files\dotnet\sdk\1.0.0\NuGet.targets(97,5): error : One or more packages are incompatible with .NETCoreApp,Version=v1.1. [C:\Users\username\Documents\test\Admin.Web.Tests\Admin.Web.Tests.csproj]

那么如何解决呢?

蝌蝌的主页 蝌蝌 | 初学一级 | 园豆:158
提问于:2017-03-20 10:00
< >
分享
最佳答案
2

编辑错误项目中的csproj文件:在PropertyGroup节点下增加portable-net45+win8+wp8+wpa81

 <PropertyGroup>
    <TargetFramework>netcoreapp1.1</TargetFramework>
    <PackageTargetFallback>portable-net45+win8+wp8+wpa81</PackageTargetFallback>
  </PropertyGroup>
蝌蝌 | 初学一级 |园豆:158 | 2017-03-20 10:02
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册