Visual Studio Code : The 'C#' extension is recommended for this file type

Viewed 6211

So I recently installed visual studio code and added the C# available extensions. I also installed the Unity Debugger but it won't work because "it depends on an unknown 'ms-vscode.csharp' extension", I tried searching for this 'ms-vscode.csharp'in the extensions bar but found nothing. whenever i open a C# file from Unity or from any folder it recommends me to install that uknown C# extensions. what can i do please? here is a picture of the message:

enter image description here

5 Answers

To manually install the correct c# extension, do the following:

  • Uninstall existing vscode C# plugin
  • Close vscode
  • Download the vsix 1.21.12 from here
  • Open a command line in the folder where the vsix is.
  • Type: code --install-extension .\csharp-1.21.12.vsix

You should see:

Installing extensions...
Extension 'csharp-1.21.12.vsix' was successfully installed.

Open VSCode and in the C# output window, you will see:

Installing C# dependencies...
Platform: win32, x86_64

Downloading package 'OmniSharp for Windows (.NET 4.6 / x64)' (32544 KB).................... Done!
Validating download...
Integrity Check succeeded.
Installing package 'OmniSharp for Windows (.NET 4.6 / x64)'

Errors should now have gone away.

I delete [.vscode\extensions], swith to 1.21.1/February 2018 and then update to 1.42.1. It finally works fine! Maybe System setup doesn't have the problem. It only occurs on User setup.

That error happens because microsoft changed marketplace publisher from ms-vscode to ms-dotnettools. Mentioned here on github. You can just install the version v1.21.18 and that should solve it.

VsCode version selection

Related