none
How to compile C# program in Visual Studio Code

    Question

  • Hi All

    This sound like a stupid question. But I cant seem to figure out how to compile code in Visual Studio Code (on windows client). I checked documentation and its all about editing. Can anyone please advise if its possible to compile in Visual Studio Code?


    Thanks Mohit

    Friday, December 18, 2015 2:23 PM

Answers

  • Ok, so it finally seems to have resolved. It seems that first I need to open node.js command prompt, create a project inside it using yo aspnet, navigate to project, install nuget packages, run visual studio code from inside it. It then runs fine.


    Thanks Mohit


    • Edited by mohit.goyal Tuesday, December 22, 2015 2:10 PM
    • Marked as answer by mohit.goyal Tuesday, December 22, 2015 2:11 PM
    Tuesday, December 22, 2015 2:09 PM

All replies

  • Hi mohit.goyal,

    You can check out this StackOverflow forum post:
    http://stackoverflow.com/questions/30150022/how-to-compile-c-sharp-in-microsofts-new-visual-studio-code

    Best regards!
    (If this was helpful for you, vote for it and propose it as an answer)

    Friday, December 18, 2015 7:41 PM
  • Thanks Almir. That link is not useful as I keep getting error that omniserver is not running. May be this has something to do with mono. I'll try to install mono separately and check it out.

    Thanks Mohit


    • Edited by mohit.goyal Saturday, December 19, 2015 5:46 AM
    Saturday, December 19, 2015 5:45 AM
  • Hi Mohit,

    As far as I know. Visual Studio Code support to debugging of C# apps cross-platform via Mono.

    You could refer to the document below:

    https://code.visualstudio.com/docs/languages/csharp

    For your error. if you have any update. Please feel free to share here.

    Best Regards,

    Lake Xiao

    Monday, December 21, 2015 9:27 AM
    Moderator
  • Installed/Uninstalled both mono and Visual Studio code. Still same error. OmniSharp server is not running. May be a stupid question but how can it debug without compilation?

    Thanks Mohit


    • Edited by mohit.goyal Monday, December 21, 2015 11:47 AM
    Monday, December 21, 2015 11:26 AM
  • Hi mohit,

    How about not using OmniSharp Sever?

    Or you can refer this blog which may be helpful to you.

    http://stackoverflow.com/questions/8264323/how-to-compile-a-visual-studio-c-sharp-project-with-mono

    Best Regards,

    Lake Xiao


    Tuesday, December 22, 2015 2:06 AM
    Moderator
  • Hi Lake

    Thanks. But this is not what I'm looking for. It seems that mono debugging is not supported in visual studio code on a windows client:

    http://stackoverflow.com/questions/29954689/vscode-how-to-setup-debugging-mono-c

    Funny its so hard to find it in documentation. Here's is a slide I found in one of the VS code webinars:

    so it seems that i'm back to my original case of "OmniSharp server is not running". May be I'll try this on some Linux system.

    PS - I wanted to build in visual studio using C# and deploy on Linux.


    Thanks Mohit




    • Edited by mohit.goyal Tuesday, December 22, 2015 11:12 AM
    Tuesday, December 22, 2015 10:44 AM
  • Ok, so it finally seems to have resolved. It seems that first I need to open node.js command prompt, create a project inside it using yo aspnet, navigate to project, install nuget packages, run visual studio code from inside it. It then runs fine.


    Thanks Mohit


    • Edited by mohit.goyal Tuesday, December 22, 2015 2:10 PM
    • Marked as answer by mohit.goyal Tuesday, December 22, 2015 2:11 PM
    Tuesday, December 22, 2015 2:09 PM