azureasp.net-core.net-corednxdnvm

Kestrel Running which framework?


I have a new ASP.NET 5 project and setup the project.json as below;

    "frameworks": {
    "dnx451":  {
        "dependencies": {
            "ExternalLibrary": "1.3.0" }
        },
    "dnxcore50": {}
}

I'm running the project through Kestrel with the default command defined in project.json.

"kestrel": "Microsoft.AspNet.Hosting --server Kestrel --server.urls http://localhost:5001"

Everything works fine. The project runs and the dependency works well. The only thing I don't understand it who decides on which underlying framework to use?

As far as I understand the project should fail if Kestrel uses dnxcore50. If that is the case how do we push Kestrel to use it?

Just as a side note, the project runs pretty good with no errors at all, but when I try to manually build the project with DNU I get the error below. I don't consider it critical at this point, as it does not cause a failure during run time as far as I can see. Just wanted to add it in case it helps.

http://pastebin.com/x44VtXct


Solution

  • In Visual Studio 2015, the framework used is determined in this order:

    1. The project properties. Right-Click the .xproj in your Solution Explorer and select Properties. Head to the "Application" section (the default), and you can "Use Specific DNX version", including version, platform, and architecture.

    2. The global.json. I don't know if the platform can be changed here, but for example:

      "sdk": {
          "version": "1.0.0-beta6-12032"
      }
      
    3. Visual Studio uses a specific runtime by default depending on its version. I believe that VS 2015 RC uses beta4, .Net Framework, x64 by default.

    When running from the command line, it's determined by your active dnvm. You can use the command dnvm list to display your installed VMs. You'll get a list similar to the following:

    Active Version           Runtime Architecture Location                    Alias
    ------ -------           ------- ------------ --------                    -----
           1.0.0-beta4       clr     x64          C:\Users\Matt\.dnx\runtimes
           1.0.0-beta4       clr     x86          C:\Users\Matt\.dnx\runtimes
           1.0.0-beta4       coreclr x64          C:\Users\Matt\.dnx\runtimes
           1.0.0-beta4       coreclr x86          C:\Users\Matt\.dnx\runtimes
           1.0.0-beta4-11566 clr     x86          C:\Users\Matt\.dnx\runtimes
           1.0.0-beta5-11855 clr     x64          C:\Users\Matt\.dnx\runtimes
           1.0.0-beta5-11855 clr     x86          C:\Users\Matt\.dnx\runtimes
           1.0.0-beta5-11855 coreclr x64          C:\Users\Matt\.dnx\runtimes
           1.0.0-beta6-11921 clr     x64          C:\Users\Matt\.dnx\runtimes
           1.0.0-beta6-11921 clr     x86          C:\Users\Matt\.dnx\runtimes x64
           1.0.0-beta6-12005 clr     x64          C:\Users\Matt\.dnx\runtimes
           1.0.0-beta6-12005 clr     x86          C:\Users\Matt\.dnx\runtimes
      *    1.0.0-beta6-12032 clr     x64          C:\Users\Matt\.dnx\runtimes default
           1.0.0-beta6-12032 clr     x86          C:\Users\Matt\.dnx\runtimes
    

    The * indicates your current VM. coreclr uses dnxcore50, and the others (likely mono on your Mac) use the corresponding framework, but seem to compile as dnx451.