After Visual Studio 2019 creates a .NET Core console application, the number of "Solution" projects in it is displayed as 0, as shown in the figure below:
Try to import the .csproj file through "File - Add - Existing Project" to solve the problem
As a result, an error is reported: "The .NET Core SDK cannot be located." "The .NET Core SDK cannot be found"
The solution is as follows:
- Find the SDK version of dotnet under the file C:\Program Files\dotnet\sdk, as shown in the figure
C:\Program Files\dotnet\sdk
2. Knowing that the native SDK version is 3.1.301, create a global.json file in the root directory of the project file.
3. Write the following code in the global.json file, where version is the native SDK version number:
{
"sdk": {
"version": "3.1.301",
"rollForward": "latestFeature",
"allowPrerelease": false
}
}
4. At this time, import the .csproj file again through "File - Add - Existing Project", the SDK will no longer report an error, and the number of projects in the "Solution" has also returned to normal
The above methods are successfully solved on this machine: "The solution shows 0 projects", "The .NET Core SDK cannot be located.", "The .NET Core SDK cannot be found" problems