markjprice / cs10dotnet6

Repository for the Packt Publishing book titled "C# 10 and .NET 6 - Modern Cross-Platform Development" by Mark J. Price
856 stars 375 forks source link

OmniSharp.MSBuild.ProjectManager - Attempted to update project that is not loaded #9

Open umesh2096 opened 2 years ago

umesh2096 commented 2 years ago

Getting Below Error after installing C# extension:-

    Loading project: /Users/umesh/C#10/Code/Chapter02-vscode/Vocabulary/Vocabulary.csproj

It was not possible to find any installed .NET SDKs. Install a .NET SDK from: https://aka.ms/dotnet-download

    Failed to load project file '{projectFilePath}'.

Microsoft.Build.Exceptions.InvalidProjectFileException: The SDK 'Microsoft.NET.Sdk' specified could not be found.

umesh@Umeshs-MacBook-Air Vocabulary % dotnet --info .NET SDK (reflecting any global.json): Version: 6.0.100 Commit: 9e8b04bbff

Runtime Environment: OS Name: Mac OS X OS Version: 12.0 OS Platform: Darwin RID: osx-x64 Base Path: /usr/local/share/dotnet/x64/sdk/6.0.100/

Host (useful for support): Version: 6.0.0 Commit: 4822e3c3aa

.NET SDKs installed: 5.0.403 [/usr/local/share/dotnet/x64/sdk] 6.0.100 [/usr/local/share/dotnet/x64/sdk]

.NET runtimes installed: Microsoft.AspNetCore.App 5.0.12 [/usr/local/share/dotnet/x64/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.0 [/usr/local/share/dotnet/x64/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 5.0.12 [/usr/local/share/dotnet/x64/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.0 [/usr/local/share/dotnet/x64/shared/Microsoft.NETCore.App]

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

markjprice commented 2 years ago

Does your MacBook Air have an Intel CPU? If it is an M1, then it might be a mismatch on CPU architecture, e.g. Visual Studio Code and the C# extension are for Intel running through Rosetta but the .NET SDKs are M1? Or vice versa?

Less likely, but when I had lots of old Previews installed, I got a point where entering dotnet at command-line gave "SDK not found" errors like yours on my Windows laptop. I could only fix it by removing all .NET SDKs and runtimes and any folders they left behind and starting clean. But it looks like you've got a clean setup anyway.

I've tried Googling your error. You could try something like this: https://github.com/OmniSharp/omnisharp-roslyn/issues/1313#issuecomment-429039879

I'll try on my Mac mini with M1 later but I do not have an Intel Mac any more so I cannot test that.