When you open a project in .net core, Visual Studio may not open it, prompting the following error.
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.
The reason for this error is that the project specifies the SDK version of the project via global.json, for example, Ocelot’s global.json specifies 2.1.301
{
“projects”: [ “src”, “test” ],
“sdk”: {
“version”: “2.1.301”
}
}
I don’t have this version of SDK installed on my machine, the solution is to install this version of SDK.