7

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.

Daniel Imms
  • 47,944
  • 19
  • 150
  • 166
v1n1akabozo
  • 257
  • 1
  • 4
  • 11

1 Answers1

9

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

LimpingNinja
  • 618
  • 1
  • 5
  • 16
  • I will try this one, but just to make it clear, it will generate a fully executable? – v1n1akabozo Feb 22 '16 at 03:37
  • because all i managed to do thus far is to generate a *.cmd file that won't run unless i use 'dnx run' on a command prompt – v1n1akabozo Feb 22 '16 at 03:38
  • 1
    @v1n1akabozo When configured with this you are running MSBUILD. Just as if you were compiling from the command line. – LimpingNinja Feb 22 '16 at 05:02
  • Just found this out by myself hahaha. Only issue is that it won't work because this tasks file is on another folder, in which there's nothing to build. How can i target the build to a upper folder? – v1n1akabozo Feb 22 '16 at 05:07
  • managed to make it work by creating a csproj file for the project. Yeoman generator won't create one and that's why it wasn't working properly. – v1n1akabozo Feb 22 '16 at 05:23