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

The question is pretty simple. Using VS Code (not a visual studio), I was able to run it using the dnx run command, but how can I ask someone to install it 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 Microsoft Build Tools to use msbuild and also had to create a .csproj file that was not provided by the Yeoman generator, which was used to create the project.

+6
source share
1 answer

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

F1 Launch the command task palette

After you click this, you will probably receive an error message in which you do not have a created workplace, you can click the button or return to the command palette and edit the tasks.

What this will do is create a .vscode directory with the tasks.json file in it, you can either skip and uncomment the msbuild section, or simply insert 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" } ] } 

After you have done this, you can edit your build specifications, and either the command or CTRL + SHIFT + B will launch the builder. Here is the link for Tasks : Tasks in Visual Studio Code

+7
source

All Articles