Search code examples
c#visual-studiosolution-explorer

Winforms app missing files in Solution Explorer


When I try to create a windows forms app in C# in visual studio and the project opens, I don't
find any files in the Solution Explorer.

I doubted that something wrong happened when installing Visual Studio, so I reinstalled my Windows operating system and then visual studio, but the problem still exists.

I searched a lot but didn't find similar problems like this. I attached some helpful screenshots that also include the installed components.

Thanks in advance to those who will help me.

Installed components in Visual Studio The app I want to create The solution explorer is empty

At first, I tried to reinstall visual studio, then I reinstalled my Windows operating system and then visual studio, but the problem still exists.


Solution

  • Normally, the dotnet environment variable is automatically added when Visual Studio and related environments are installed using the Visual Studio installer. However, multiple dotnet environment variables may appear because a previously installed environment has not been fully uninstalled or for other reasons.

    You can fix this issue with the following steps:

    1. Open the environment variables of your computer and check whether there are more than two dotnet paths in Path, as follows:

    enter image description here

    enter image description here

    1. At this time, you need to check your real dotnet path, and then delete the redundant ones. This is my correct path

    enter image description here

    1. Then open CMD again and enter "dotnet --info", then the SDK will display normally

    enter image description here

    1. Finally, please reopen Visual Studio and you should be able to see your project