dotnet / vscode-csharp

Official C# support for Visual Studio Code
MIT License
2.86k stars 673 forks source link

Command '.NET: Generate Assets for Build and Debug' resulted in an error. #2865

Closed derviskiratli closed 5 years ago

derviskiratli commented 5 years ago

Issue Description

Error message when running the '.NET: Generate Assets for Build and Debug command

Steps to Reproduce

  1. Create a new asp dotnet core project.
  2. Open it with Visual Studio.
  3. Run the '.NET: Generate Assets for Build and Debug command.

    Expected Behavior

    Creation of the necessary JSON files.

    Actual Behavior

    Error message: Command '.NET: Generate Assets for Build and Debug' resulted in an error. image

Environment information

VSCode version: 1.31.1 C# Extension: 1.17.1

Dotnet Information .NET Core SDK (reflecting any global.json): Version: 2.2.104 Commit: 73f036d4ac Runtime Environment: OS Name: Windows OS Version: 10.0.16299 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\2.2.104\ Host (useful for support): Version: 2.2.2 Commit: a4fd7b2c84 .NET Core SDKs installed: 2.1.202 [C:\Program Files\dotnet\sdk] 2.1.402 [C:\Program Files\dotnet\sdk] 2.1.403 [C:\Program Files\dotnet\sdk] 2.1.504 [C:\Program Files\dotnet\sdk] 2.2.104 [C:\Program Files\dotnet\sdk] .NET Core runtimes installed: Microsoft.AspNetCore.All 2.1.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.All 2.1.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.All 2.1.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.All 2.2.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.App 2.1.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 2.1.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 2.1.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 2.2.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 2.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.1.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.1.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.1.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.2.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] To install additional .NET Core runtimes or SDKs: https://aka.ms/dotnet-download
Visual Studio Code Extensions |Extension|Author|Version| |---|---|---| |csharp|ms-vscode|1.17.1| |npm-intellisense|christian-kohler|1.3.0| |vetur|octref|0.16.1| |vscode-npm-script|eg2|0.3.5| |vue-inline-template|faisalhakim47|1.0.1|;
rchande commented 5 years ago

@derviskiratli I wasn't able to reproduce this with a project created via dotnet new web--would you mind sharing your omnisharp log?

derviskiratli commented 5 years ago

Starting OmniSharp server at 20/2/2019 22:54:15 Target: c:\Users\11500677\Desktop\School 2018-2019\Programming Advanced\Net\repos\OdeToFood\OdeToFood.sln

[ERROR] Error: spawn cmd ENOENT

Just fixed it. I had to add a PATH variable to C:\Windows\System32. And now it works

yonasayfu commented 4 years ago

Just Uninstall C# Extension and Re Install again, this worked for me.

Rajkumar777108 commented 4 years ago

Adding PATH variable to C:\Windows\System32, worked for me..

ThijmenLTH commented 4 years ago

How can you add PATH variable @Rajkumar777108 ??

f2calv commented 3 years ago

I had to add

"omnisharp.useGlobalMono": "never"

to my vscode settings.json see https://github.com/OmniSharp/omnisharp-vscode/issues/4219 for more info.

Sahira22 commented 3 years ago

I just uninstalled it and Install a old version. It worked for me

GoodGuyGregory commented 3 years ago

I had to add

"omnisharp.useGlobalMono": "never"

to my vscode settings.json see #4219 for more info.

Where in VSCode did you add this? in your launchsettings.json? or somewhere else?

GoodGuyGregory commented 3 years ago

I also reinstalled the C# extension and everything appears to be working. but I dont see this as a healthy alternative to writing C# code and debugging on a mac

vimalra commented 2 years ago

For Windows Show all Commands Ctrl +Shift + p, then search for assets then choose NET: Generate Assets for Build and Debug Little prompt on your right bottom -> Say Yes.