tintoy / msbuild-project-tools-vscode

VS Code extension for MSBuild intellisense (including PackageReference completion).
MIT License
82 stars 16 forks source link

Failed to start the MSBuild language server. (after .NET 6 upgrade) #90

Closed solrevdev closed 2 years ago

solrevdev commented 2 years ago

Hi,

When my version of .NET Core upgraded from .NET 5 to .NET 6 my extension started throwing the following error.

I think the issue is that when homebrew runs the .NET upgrade it actually uninstalls the previous SDK before installing the current one so that you don't end up with hundreds of .NET's lying around but that does mean that I know longer have the .NET 5 SDK installed just .NET 6.

Hope that makes sense and do shout if you need any more info or if you point me to the right place, I'm happy to have a stab at fixing it!

Thanks John

Error Message:

Starting MSBuild language service...
Failed to start the MSBuild language server.
Error: Command failed: "/usr/local/bin/dotnet" "/Users/solrevdev/.vscode-insiders/extensions/tintoy.msbuild-project-tools-0.3.15/out/language-server/MSBuildProjectTools.LanguageServer.Host.dll" --probe
It was not possible to find any compatible framework version
The framework 'Microsoft.NETCore.App', version '5.0.0' (x64) was not found.
  - The following frameworks were found:
      6.0.0 at [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

You can resolve the problem by installing the specified framework and/or SDK.

The specified framework can be found at:
  - https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=5.0.0&arch=x64&rid=osx.11.0-x64

It was not possible to find any compatible framework version
The framework 'Microsoft.NETCore.App', version '5.0.0' (x64) was not found.
  - The following frameworks were found:
      6.0.0 at [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

You can resolve the problem by installing the specified framework and/or SDK.

The specified framework can be found at:
  - https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=5.0.0&arch=x64&rid=osx.11.0-x64

Extension Version:

tintoy.msbuild-project-tools-0.3.15

VS Code Insiders:

1.63.0-insider
bedf867b5b02c1c800fbaf4d6ce09cefbafa1592
x64

.NET

▲ ~ dotnet --info
.NET SDK (reflecting any global.json):
 Version:   6.0.100
 Commit:    9e8b04bbff

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

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

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

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

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

▲ ~ dotnet --list-sdks
6.0.100 [/usr/local/share/dotnet/sdk]

▲ ~ dotnet --version
6.0.100

MacOS:

OS: macOS 11.6 20G165 x86_64
Host: Macmini7,1
Kernel: 20.6.0
Uptime: 4 days, 9 mins
Packages: 312 (brew)
Shell: zsh 5.8
Resolution: 2560x1440
DE: Aqua
WM: Quartz Compositor
WM Theme: Blue (Light)
Terminal: iTerm2
Terminal Font: AnonymicePowerline 14
CPU: Intel i5-4278U (4) @ 2.60GHz
GPU: Intel Iris
Memory: 9560MiB / 16384MiB
tintoy commented 2 years ago

You don’t need the 5.x SDK, just the 5.x runtime. Can you try the VSIX from this build to see if it works for you? I just realised I forgot to publish it to the VS gallery.

https://github.com/tintoy/msbuild-project-tools-vscode/releases/tag/v0.4.1

It’s the new build that targets .net 6.

tintoy commented 2 years ago

(sorry about that!)

solrevdev commented 2 years ago

Bingo!

Yep, that works great thank you. 🙏

I ran Extensions: Install from VSIX... from VS Code Insiders command pallete, then when I view the MSBuild Project Tools logs via the Output window I get this lovely message

Starting MSBuild language service...
MSBuild language service is running.
tintoy commented 2 years ago

Thanks! I’ll get that new package published :)

pm4rcin commented 2 years ago

@tintoy could you also publish on open-vsx? :)

tintoy commented 2 years ago

Sure, will do :)

baronfel commented 2 years ago

@tintoy in addition to the 5.x Runtime, you could also spawn the .NET executable with the --roll-forward LatestMajor flag, which attempts to run the binary on the latest Runtime the user has installed. OR you can set <RollForward>LatestMajor</RollForward> in the project file, which will add the flag to the deps.json file and tell the runtime to do this as well. This is what I do in Ionide for the the FsAutoComplete F# Language Server, since it still targets the net5.0 TFM.

tintoy commented 2 years ago

@tintoy could you also publish on open-vsx? :)

Sorry, I haven't had time to do this yet (first week at a new job and things are super-busy!). I'll try to get it done tonight :)

tintoy commented 2 years ago

@pm4rcin - now also published to open-vsx :)

pm4rcin commented 2 years ago

@tintoy I think it could be closed.

tintoy commented 2 years ago

Thanks! Sorry, this one kinda fell through the cracks :)