0

newbie question here, I wanted to start in my free time with some desktop development so I installed Visual Studio 2022. Going through the motions I created C# solution and project but for some strange reason inside solution explorer I cannot see my project at all: solution explorer which exist on HD: explorer and when I try to add a project manually I get missing .net. SDK error.

This happens when I create a new project, so I have not done anything because of this, for example, I can not even run it since the upper green play icon is showing attach.

Can someone please tell me what I am doing wrong and how can I fix this?

I created a new project expecting to run it (console project) and get hello world as output, instead solution explorer does not see the project at all and I can not add it manually or run it.

  • Can you paste the contents of the .csproj file? Sounds like you are targeting (on the project) an SDK version not supported by Visual Studio (or you haven't installed the correct Visual Studio payloads to support it, but that's usually more rare unless you installed it very bare) – Jcl Mar 07 '23 at 18:42
  • Here is content of .csproj file: Exe net7.0 enable enable I have net 7 installed, latest version – Sasa Mirkov Mar 07 '23 at 20:24

1 Answers1

1

You can troubleshoot further by trying below steps;

1 - Open command prompt to confirm the list of SDK installed by executing this command dotnet --list-sdks

2 - Confirm from your .csproj file if the target framework is on the list above < TargetFramework>net6.0< TargetFramework>

3 - If not, install the missing sdk or change the version of the target framework to what you have installed

4 - incase sdk is listed, you can try this manual process;

open the .sln in visual studio ==> Right click on solution ==> Add ==> Existing Project ==> navigate to the .csproj folder ==> select the .csproj and open.

  • I have installed net 7 and it is listed. manually adding it gives me the following: The SDK 'Microsoft.NET.Sdk' specified could not be found. and path to file.csproj – Sasa Mirkov Mar 07 '23 at 21:24
  • I found a thread here that can be helpful https://stackoverflow.com/questions/46257393/msbuild-throws-error-the-sdk-microsoft-net-sdk-specified-could-not-be-found – Habeebullah_B Mar 07 '23 at 21:31