简体   繁体   中英

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

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:

在此处输入图像描述

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.

That was a mistake by Microsoft. I just spent hours to solve the problem and noticed that actually the name of the plugin was recently changed, leading to the error. We can fix it by manually downloading a previous version of the plugin. Link: https://marketplace.visualstudio.com/items?itemName=ms-dotnettools.csharp&ssr=false#review-details

I don't do Unity development, but this may help: https://code.visualstudio.com/docs/other/unity

Keep in mind that VSCode is only going to be an editor for your project files.

(Can't comment, apologies for the brief answer)

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 版本选择

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM