当你打开一个.net core的项目,Visual Studio 可能无法打开,提示如下错误:

D:\workshop\Github\Ocelot\src\Ocelot\Ocelot.csproj : error  : Project file is incomplete. Expected imports are missing.

D:\workshop\Github\Ocelot\test\Ocelot.UnitTests\Ocelot.UnitTests.csproj : error  : Project file is incomplete. Expected imports are missing.

D:\workshop\Github\Ocelot\test\Ocelot.AcceptanceTests\Ocelot.AcceptanceTests.csproj : error  : Project file is incomplete. Expected imports are missing.

D:\workshop\Github\Ocelot\test\Ocelot.ManualTest\Ocelot.ManualTest.csproj : error  : Project file is incomplete. Expected imports are missing.

D:\workshop\Github\Ocelot\test\Ocelot.Benchmarks\Ocelot.Benchmarks.csproj : error  : Project file is incomplete. Expected imports are missing.

D:\workshop\Github\Ocelot\test\Ocelot.IntegrationTests\Ocelot.IntegrationTests.csproj : error  : Project file is incomplete. Expected imports are missing.

D:\workshop\Github\Ocelot\src\Ocelot\Ocelot.csproj : error  : Project file is incomplete. Expected imports are missing.

这个错误的原因是项目通过global.json 指定了项目的SDK版本,比如Ocelot的global.json 指定了2.1.301

{
   "projects": [ "src", "test" ],
   "sdk": {
     "version": "2.1.301"
   }
}

我的机器上没有安装这个版本的SDK,解决方法就是安装这个版本的SDK。

相关文章:

  • 2022-01-08
  • 2021-11-04
  • 2022-12-23
  • 2021-08-12
  • 2022-01-21
  • 2022-12-23
猜你喜欢
  • 2021-12-13
  • 2021-04-18
  • 2022-01-06
  • 2021-11-27
  • 2021-09-14
  • 2021-12-03
  • 2021-08-05
相关资源
相似解决方案