Open washeduplizard opened 1 year ago
Have you tried dotnet clean
and dotnet build
after installing the new SDK?
Yes, I have. Retried just now as well for good measure but to no avail.
I see this as well. I don't see any relevant logs in the OmniSharp window, but I do see it's finding both .NET 6 and 7. I'll include logs below.
If I update global.json
to specify .NET 7 SDK and update the list of target frameworks to include net7.0
this goes away, but just one or the other doesn't fix it.
I tried dotnet clean
and dotnet build
, it didn't fix the issue.
Logs from OmniSharp, if it helps. This is a project where global.json
specifies .NET 6.0.401 (which is installed) and the target framework is only net6.0
.
Starting OmniSharp server at 11/18/2022, 9:32:56 AM
Target: /Users/tillig/dev/my-project/MyProject.sln
OmniSharp server started with .NET 6.0.401
.
Path: /Users/tillig/.vscode/extensions/ms-dotnettools.csharp-1.25.2-darwin-x64/.omnisharp/1.39.2-net6.0/OmniSharp.dll
PID: 46837
[info]: OmniSharp.Stdio.Host
Starting OmniSharp on Unknown 0.0 (Unknown)
[info]: OmniSharp.Services.DotNetCliService
Checking the 'DOTNET_ROOT' environment variable to find a .NET SDK
[info]: OmniSharp.Services.DotNetCliService
Using the 'dotnet' on the PATH.
[info]: OmniSharp.Services.DotNetCliService
DotNetPath set to dotnet
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
Located 2 MSBuild instance(s)
1: .NET Core SDK 7.0.100 17.4.0 - "/usr/local/share/dotnet/sdk/7.0.100/"
2: .NET Core SDK 6.0.401 17.3.1 - "/usr/local/share/dotnet/sdk/6.0.401/"
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
Registered MSBuild instance: .NET Core SDK 7.0.100 17.4.0 - "/usr/local/share/dotnet/sdk/7.0.100/"
[info]: OmniSharp.WorkspaceInitializer
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpFormattingWorkspaceOptionsProvider, Order: 0
Same problem, any hint?
Also seeing this same problem. Cannot use VS Code for .Net 6 projects after installing .Net 7 SDK. Uninstalling the .Net 7 SDK resolves the problem.
And the real kicker is until OmniSharp.SdkInstanceProvider fails to parse 'omnisharp.sdkVersion' and 'omnisharp.sdkPath' is fixed, I think maybe the only solution is to keep uninstalling the SDK for .Net 6 and then reinstalling when working on a .Net 7 project.
And the real kicker is until OmniSharp.SdkInstanceProvider fails to parse 'omnisharp.sdkVersion' and 'omnisharp.sdkPath' is fixed, I think maybe the only solution is to keep uninstalling the SDK for .Net 6 and then reinstalling when working on a .Net 7 project.
I am sorry for your trouble. The handling of these properties was fixed already but the patched extension has not been released yet. However, there are other ways of telling OmniSharp which SDK to use than just using the VS Code options.
You can create a file omnisharp.json
and set:
{
"sdk": {
"path": "/usr/local/share/dotnet/sdk/6.0.403/",
"version": "6.0.403"
}
}
in it. The file can be placed in the root directory of your solution (then it applies only there) or in %USERPROFILE%/.omnisharp/omnisharp.json
, then it applies globally.
See here for more details https://github.com/OmniSharp/omnisharp-roslyn/wiki/Configuration-Options#sdk-options
Issue Description
NET 7 installation makes omnisharp redline AspNetCore packages on previous .NET sdks on MacOS+VSCode
Steps to Reproduce
Have .NET 7 installed on machine Open Project or solution in VSCode running .NET 6 project or solution will restore and build successfully but code and packages will be redlined
Expected Behavior
Omnisharp should not redline
Actual Behavior
Logs
OmniSharp log
C# log
Environment information
VSCode version: 1.73.1 C# Extension: 1.25.2
Mono Information
OmniSharp using mono: 6.12.0Dotnet Information
.NET SDK: Version: 7.0.100 Commit: e12b7af219 Runtime Environment: OS Name: Mac OS X OS Version: 12.6 OS Platform: Darwin RID: osx.12-x64 Base Path: /usr/local/share/dotnet/sdk/7.0.100/ Host: Version: 7.0.0 Architecture: x64 Commit: d099f075e4 .NET SDKs installed: 3.1.416 [/usr/local/share/dotnet/sdk] 3.1.417 [/usr/local/share/dotnet/sdk] 5.0.405 [/usr/local/share/dotnet/sdk] 5.0.406 [/usr/local/share/dotnet/sdk] 6.0.201 [/usr/local/share/dotnet/sdk] 7.0.100 [/usr/local/share/dotnet/sdk] .NET runtimes installed: Microsoft.AspNetCore.App 3.1.22 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.23 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 5.0.14 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 5.0.15 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.3 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 7.0.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 3.1.22 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.23 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.14 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.15 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.3 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 7.0.0 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] Other architectures found: None Environment variables: Not set global.json file: Not found Learn more: https://aka.ms/dotnet/info Download .NET: https://aka.ms/dotnet/downloadVisual Studio Code Extensions
|Extension|Author|Version| |---|---|---| |angular-schematics|cyrilletuzi|5.2.8| |auto-barrel|mikehanson|1.10.0| |code-spell-checker|streetsidesoftware|2.11.0| |csharp|ms-dotnettools|1.25.2| |csharpextensions|kreativ-software|1.7.3| |csharpier-vscode|csharpier|1.3.5| |data-workspace-vscode|ms-mssql|0.3.0| |dotnet-test-explorer|formulahendry|0.7.8| |EditorConfig|EditorConfig|0.16.4| |intellicode-api-usage-examples|VisualStudioExptTeam|0.2.6| |java|redhat|1.12.0| |mssql|ms-mssql|1.16.0| |ng-template|Angular|14.2.0| |ng-zorro-vscode|cipchk|14.0.2| |powershell|ms-vscode|2022.10.0| |prettier-vscode|esbenp|9.9.0| |remote-containers|ms-vscode-remote|0.262.3| |sort-js-object-keys|zengxingxin|1.0.6| |sql-bindings-vscode|ms-mssql|0.3.0| |sql-database-projects-vscode|ms-mssql|0.19.0| |user-secrets|adrianwilczynski|2.0.1| |vscode-docker|ms-azuretools|1.22.2| |vscode-eslint|dbaeumer|2.2.6| |vscode-java-debug|vscjava|0.46.0| |vscode-java-dependency|vscjava|0.21.1| |vscode-java-pack|vscjava|0.25.6| |vscode-java-test|vscjava|0.37.1| |vscode-kubernetes-tools|ms-kubernetes-tools|1.3.11| |vscode-lombok|vscjava|1.1.0| |vscode-maven|vscjava|0.39.2| |vscode-mysql|formulahendry|0.4.1| |vscode-pull-request-github|GitHub|0.54.1| |vscode-structurizr|ciarant|0.0.9| |vscode-stylelint|stylelint|1.2.3| |vscode-typescript-tslint-plugin|ms-vscode|1.3.4| |vscode-yaml|redhat|1.10.1| |vscodeintellicode|VisualStudioExptTeam|1.2.29|;