8

When I run dotnet build on my code from my WSL (Windows Subsystem for Linux) distro, C# intellisense breaks and I get errors like the following:

enter image description here

I've managed to set up the launch configurations found here, but that doesn't help with Intellisense, unless I've missed something.

I presume it has something to do with path configurations, but I'm not sure what to change, or where I should change it.

In short, how can I compile and run my code on WSL and edit it in VS Code without errors or warnings?

Chris Paton
  • 5,113
  • 4
  • 41
  • 52

2 Answers2

1

There are more possible solutions:


Your folder structure is not correct:

  1. Use Terminal in VSCode and create a folder, like mkdir MyProject
  2. Create your project in the new folder from Terminal, for example: dotnet new console

Wrong Settings:

Go to:

Code -> Preferences -> Settings 

and remove "omnisharp.useMono": true/false

Additionally, you can open your project with Visual Studio or MonoDevelop and then reopen in VSCode.


You have wrong input parameters in your TryParseExact #LAUGHING

Sean Stayns
  • 4,082
  • 5
  • 25
  • 35
1

As I fell into this question when I looked for this problem I decided to go back to show how I managed to solve it.

To OmniSharp work with WSL i installed the Insiders version of VS Code and the extension Remote - WSL. Done.

Links:

OBS: You have to install on your WSL Linux distro the wget and msbuild