Skip to content

Generating a binary for a console application #590

Closed
@deevus

Description

@deevus

How do I generate a binary for a console application?

dnu build generates a dll. I would like an executable.

project.json:

{
    "dependencies": {
        "xunit": "2.1.0-*",
        "xunit.runner.dnx" : "2.1.0-*"

    },
    "commands": {
        "ConsoleApplication": "ConsoleApplication",
        "test": "xunit.runner.dnx"
    },
    "frameworks": {
        "dnx451": { },
        "dnxcore50": {
            "dependencies": {
                "System.Console": "4.0.0-beta-22816",
                "System.Collections": "4.0.10-beta-22816",
                "System.Linq": "4.0.0-beta-22816"
            }
        }
    }
}

Program.cs:

// A Hello World! program in C#. 
using System;
using System.Linq;

public class Program 
{
    static void Main() 
    {
        Console.WriteLine("Hello World!");

        var array = new [] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
        foreach (int i in array.Where(i => i > 5)) {
            Console.WriteLine(i);
        }
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions