Compiling C# projects with VSCode on Ubuntu

前端 未结 1 1891
青春惊慌失措
青春惊慌失措 2021-02-02 09:58

I set up VSCode on Ubuntu 14.04 according to the various tutorials available in the documentation - I tried as many as I could make sense of. The editor runs without issue and (

1条回答
  •  北荒
    北荒 (楼主)
    2021-02-02 10:14

    I must have been impatient when looking through the default tasks.json file last night. There is a section that refers to msbuild (towards the bottom):

    // Uncomment the section below to use msbuild and generate problems 
    // for csc, cpp, tsc and vb. The configuration assumes that msbuild 
    // is available on the path and a solution file exists in the  
    // workspace folder root. 
    /* 
    {   
        "version": "0.1.0",
        "command": "msbuild",
        "args": [
            // Ask msbuild to generate full paths for file names.       
            "/property:GenerateFullPaths=true"  
        ],
        "taskSelector": "/t:",
        "showOutput": "silent",
        "tasks": [
            {
                "taskName": "build",
                // Show the output window only if unrecognized errors occur.            
                "showOutput": "silent",
                // Use the standard MS compiler pattern to detect errors, warnings          
                // and infos in the output.
                "problemMatcher": "$msCompile"
            }   
         ] 
     }
    */
    

    Just comment out the rest of the file, uncomment the above JSON text, and change "command" from "msbuild" to "xbuild" (the Mono equivalent). Now hitting ctrl+shift+B successfully compiles the project.

    Hopefully, this manual tinkering with configuration files will be less necessary or tedious once it comes out of preview.

    EDIT

    Marking this as answer for now. Will update or accept a better answer should things change during the evolution of the product.

    0 讨论(0)
提交回复
热议问题