TransWikia.com

Visual Studio 2019 shows an empty solution after creating a .NET Core project

Stack Overflow Asked by Araf Hasan on January 1, 2022

When I create a new .NET Core project in Visual Studio 2019, it shows only the solution file. Other files are not showing and also I am not able to debug or the project.

An empty solution node shown in Solution Explorer in Visual Studio 2019

One Answer

I've also run into this problem and after two days of searching forums and reading .NET documentations, I finally managed to find the solution.

The problem is that Visual Studio cannot find the proper SDK version. There might be a few reasons for this, but first of all, check if you have any SDK installed:

  1. Open the Command Prompt:

    Start Menu > Visual Studio 2019 > Developer Command Prompt for Visual Studio 2019

  2. Run the command: dotnet --info

Case 1:

The .NET SDKs installed: section says that you have no SDKs installed.

-OR-

A .NET SDK is installed but not for the right architecture (this was my case), meaning that you had installed x86 version instead of x64.

Solution: Uninstall all versions of .NET Core SDKs and Runtimes, then download and install the latest x64 SDK and Runtime version from Microsoft's webpage.

Case 2:

A .NET SDK is installed but the referenced SDK version in the current project's .csproj file does not match the installed version nor the one specified in the global.json (if exists).

Solution: Edit the .csproj file, so that the SDK versions match. If you have or need a global.json file, make sure you set its content properly. You can read more about it here.

Finally

Don't forget to open Visual Studio, create a new e.g. Console Application and see if the Solution's files appear in the Solution Explorer window (they should). Note that existing projects may still not be working properly because their .csproj file might have wrong SDK reference - if so, you have to fix them manually.

Answered by Gary on January 1, 2022

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP