Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you compile a console application with VS Code (Windows platform)?

The question is pretty straightforward. Using VS Code (not visual studio), I've been able to run it using the dnx run command but how am i supposed to ask for anyone to install it in order to run the application?

In other words, is it possible to generate an executable from VS code?

Update 1:

The selected answer is almost complete. I had to download the Microsoft Build Tools in order to use msbuild, and also had to create a .csproj file, which wasn't provided by the Yeoman generator i used to create the project.

like image 883
v1n1akabozo Avatar asked Feb 22 '16 01:02

v1n1akabozo


Video Answer


1 Answers

This is not as simple as it should be, but the way to do this is through the command palette (F1 key) and type run task, it should look like this:

F1 Command Palette Run Task

After you click this you will probably get an error in which you do not have a task runner created, you can either press the button or go back to the command palette and edit task runners.

What this will do is create a .vscode directory with a tasks.json file in it, you can either rummage through and uncomment the msbuild section or simply paste this as an override:

{   
    "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"
        }   
     ] 
 }

Once you've done that you can edit to your build specifications and either the command palette or CTRL+SHIFT+B will run the builder. Here is the link information for the Tasks: Tasks in visual Studio Code

like image 122
LimpingNinja Avatar answered Oct 21 '22 10:10

LimpingNinja