Problems with VS community 2019

Developron 21 Reputation points
2020-10-12T09:37:27.583+00:00

Hello,

To free up space, I've deleted older versions of Visual Studio (even 2010 was still installed).
In the process of removing the applications, there must have been left something behind, or deleted something too much.

After the removal, I've installed the latest community edition of Visual Studio 2019.

But it doesn't behave as expected.

When I create a new project, it looks as if it behaves coorectly.

It has created a solution and a project
The file structure seems to be OK.
But the project has not been added to the solution.

If I try to manually add the project to the solution with the Add existing project option, it gives an error.
"The project file cannot be opened. Unable to locate the .NET Core SDK. Check that it is installed and that the version specified in the global.json (if any) matches the installed version."

I've deleted all other versions of Visual Studio and .Net Framework and Core versions

Any ideas how to solve this, or where to look first?

Developer technologies | Visual Studio | Other
0 comments No comments
{count} votes

Accepted answer
  1. Tianyu Sun-MSFT 34,441 Reputation points Microsoft External Staff
    2020-10-13T03:17:12.687+00:00

    Hello Developron,

    Thank you for taking time to post this issue in Microsoft Q&A forum.

    But the project has not been added to the solution.

    Did you select this option Place solution and project in the same directory when created a new project(solution)?

    31904-2.png

    If I try to manually add the project to the solution with the Add existing project option, it gives an error.

    From your description, it seems this issue is caused by deleting some old installed versions of .NET Core SDK. Please type dotnet –list-sdks in Command Prompt to display and check the installed SDKs. You may need to install some old versions of .NET Core SDKs, for example, version 2.2.402.

    Besides, please check the system variables of Environment Variables, and make sure that the value C:\Program Files\dotnet is added for variable DOTNET(right-click This PC > Properties > Advanced system settings > Environment Variables… > System variables).

    By the way, did you install .NET Core SDK from VS Installer > VS 2019 Community > Modify > Individual Components > .NET Core SDK?

    31744-1.png

    Sincerely,
    Tianyu

    • If the answer is helpful, please click "Accept Answer" and upvote it.
      Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
    1 person found this answer helpful.
    0 comments No comments

2 additional answers

Sort by: Most helpful
  1. Developron 21 Reputation points
    2020-10-14T14:31:51.333+00:00

    Hello Tianyu,

    I've (double) checked everything you suggested.

    I've added the DOTNET variable to both sections.
    And installed the 2.2.402 SDK.

    When I run dotnet --info, I get the following information :

    It was not possible to find any installed .NET Core SDKs
    Did you mean to run .NET Core SDK commands? Install a .NET Core SDK from:
    https://aka.ms/dotnet-download

    Host (useful for support):
    Version: 3.1.9
    Commit: 774fc3d6a9

    .NET Core SDKs installed:
    No SDKs were found.

    .NET Core runtimes installed:
    Microsoft.AspNetCore.App 3.1.8 [C:\Program Files (x86)\dotnet\shared\Microsoft.AspNetCore.App]
    Microsoft.AspNetCore.App 3.1.9 [C:\Program Files (x86)\dotnet\shared\Microsoft.AspNetCore.App]
    Microsoft.NETCore.App 3.1.8 [C:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App]
    Microsoft.NETCore.App 3.1.9 [C:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App]
    Microsoft.WindowsDesktop.App 3.1.9 [C:\Program Files (x86)\dotnet\shared\Microsoft.WindowsDesktop.App]

    To install additional .NET Core runtimes or SDKs:
    https://aka.ms/dotnet-download

    When I create a new solution, the .sln file lacks the following :

    The
    Project-EndProject
    section,
    and the
    GlobalSection(SolutionConfigurationPlatforms) = preSolution
    GlobalSection(ProjectConfigurationPlatforms) = postSolution
    sections


  2. Doc Papa 1 Reputation point
    2021-11-11T20:46:59.12+00:00

    I am having this same problem on my laptop. Nothing above has helped.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.