Unable to generate assets to build and debug. OmniSharp server is not running

14,424

Solution 1

Ended up discovering the issue. I needed to add a PATH variable to C:\Windows\System32 in the System Variables. Now it works as intended.

Adding the variable depends on your Windows version. You should be able to find guides on adding Paths to your Environment Variables. Here's Microsoft's guide.

As for which path variable you need to add it'll look something like: C:\Windows\System32\WindowsPowerShell\v.1.0

Solution 2

CTRL + SHIFT + P

Use of the command :

OmniSharp: Restart OmniSharp

worked for me

enter image description here

Solution 3

This worked for me:

Ctrl + Shift + P

Then type the command:

OmniSharp: Select Project

enter image description here

Solution 4

  1. Added omnisharp.json file to the root folder with below content:

    { "msbuild": { "useBundledOnly": true } }
    
  2. Select the Command Palette using Ctrl + Shift + P and select the option "OmniSharp: Restart Omnisharp"

  3. Using the Command Palette, select the option "NET: Generate Assets for Debug and Build"

  4. The launch.json and tasks.json files will be added under the .vscode folder

  5. Now you should be able to debug your code

This solution worked for me.

Solution 5

Install the C# Extension, once installed click on the arrow on the side of the uninstall button and then click install another version. First I tried one from 2 months ago, it did not work, then I tried one from 6 months and it worked perfectly!

Share:
14,424
pav.anastas
Author by

pav.anastas

I completed my undergrad in Computer Science and my masters in IT Management and Organisational Change at Lancaster University. Heavily interested in working in a dynamic and forward-thinking environment in order to make a real impact in the industry. As a Junior developer I've worked with Java to create a physics-model based game, with Matlab to process images and to develop simulations of fountain code failure models and with Python to process data and create silly programs. I've still got much to learn, but that's the fun part!

Updated on July 24, 2022

Comments

  • pav.anastas
    pav.anastas almost 2 years

    On Visual Studio (VS) Code, coding on C#. I'm trying to generate assets to build and debug and I'm getting the following error message: Unable to generate assets to build and debug. OmniSharp server is not running.

    I'm running:

    • .NET version 3.1.301
    • Windows 8.1
    • Visual Studio Code 1.46.1 (user setup)
    • Powershell 5.1

    So far I've tried unistalling VS code and the C# extention, I updated the omnisharp.path to latest at settings.json and updated the powershell version.

    The code I'm trying to generate the assets for build and debug does run, so I'm uncertain where else I should look for the source of the problem.

    If you require any more details feel free to ask