Sometimes when working with .Net Core 2.2 project, you might end up with this error: Project file is incomplete. Expected imports are missing.
Chances are that you installed many version of dot net SDK's on your development machine and the PATH in the environment variables does not contain any for dot net core.
Here is what you do.
- Navigate to your project directory, when in Folder Explorer, on top you will find a tab called "File"
- Click on File => Open Windows Powershell => Open Windows Powershell as administrator
- When Powershell is open, cd in the Project directory and create a global.json file with an SDK defined
- Use this command to create a global.json file that defines what dot net core SDK the project must use
- dotnet new globaljson --sdk-version 2.2.100 or the SDK you want to use, make sure the SDK you define here is actually installed on the system.
- After the previous step, try to type; dotnet --version (If you have dot net SDK referenced in your environment path you should see dot net information appear in Powershell console) and pick it up from there.
- The other way you could fix this problem is by making sure that dot net SDK is installed on your machine and then navigating to the Project root directory in Powershell and typing; dotnet run
Edit this Article