.netasp.net-core.net-corepackage.json.net-core-rc2

Build .exe file in .NET Core RC2


Every time I build a project using the new .NET Core RC2 templates I am not provided with a runnable .EXE file. If I hit F5 for debugging my console application it runs fine through the

C:\Program Files\dotnet\dotnet.exe 

application. And if I use the

dotnet run 

command in the folder, it runs fine as well. But I see no way to run the application without the .NET Core CLI tools.

The contents of my

 bin\Debug\netcoreapp1.0\

folder looks like this:

Bin folder structure

As you can see there is no .EXE file available. Just the dll.

Am I overlooking something? Or is there something wrong with my project.json file?

{
  "version": "1.0.0-*",
  "buildOptions": {
    "emitEntryPoint": true
  },

  "dependencies": {
    "Microsoft.NETCore.App": {
      "type": "platform",
      "version": "1.0.0-rc2-3002702"
    }
  },

  "frameworks": {
    "netcoreapp1.0": {
      "imports": "dnxcore50"
    }
  }
}

Thanks!


Solution

  • There are actually 2 app models in .NET Core:

    You're currently using the first model. To use the standalone model, you need to tweak your project.json:

    Here's an example of a standalone app:

    {
      "buildOptions": {
        "emitEntryPoint": true,
        "preserveCompilationContext": true,
        "warningsAsErrors": true
      },
    
      "dependencies": {
        "Microsoft.Extensions.Configuration.Binder": "1.0.0-rc2-final",
        "Microsoft.Extensions.Configuration.CommandLine": "1.0.0-rc2-final",
        "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0-rc2-final",
        "Microsoft.Extensions.Configuration.Json": "1.0.0-rc2-final",
        "Microsoft.Extensions.DependencyInjection": "1.0.0-rc2-final",
        "Microsoft.Extensions.Logging": "1.0.0-rc2-final",
        "Microsoft.Extensions.Logging.Console": "1.0.0-rc2-final",
        "NETStandard.Library": "1.5.0-rc2-24027"
      },
    
      "frameworks": {
        "net451": { },
    
        "netcoreapp1.0": {
          "dependencies": {
            "System.Net.Ping": "4.0.0-rc2-24027"
          },
    
          "imports": [
            "dnxcore50",
            "dotnet5.6",
            "portable-net451+win8"
          ]
        }
      },
    
      "runtimes": {
        "win7-x64": { }
      }
    }