使用VS2017新建的Web项目报错:Package Microsoft.Composition 1.0.27 is not compatible with netcoreapp1.1
使用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]
错误项目中的csproj
文件:在PropertyGroup
节点下增加portable-net45+win8+wp8+wpa81
解决方案 :右键编辑项目添加下面内容
<PropertyGroup> <TargetFramework>netcoreapp1.1</TargetFramework> <PackageTargetFallback>portable-net45+win8+wp8+wpa81</PackageTargetFallback> </PropertyGroup>
转载:https://q.cnblogs.com/q/91766
文章属于个人工作备忘录,欢迎指正...