Kestrel Running which framework?
Asked Answered
U

1

5

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

Uptotheminute answered 15/6, 2015 at 9:53 Comment(0)
A
2

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.

Airlike answered 15/6, 2015 at 13:9 Comment(10)
Unfortunately I'm not using Visual Studio. I'm on a Mac. The DNVM I'm using is Version 1.0.0-beta5-10375. How do I know which platform this one uses? It's a little strange because the project.json suggest that I can assign different dependencies for both dnxcore and dnx451. How would both work on the current DNVM version that I have on my machine? It does not feel like the dnxcore vs dnx451 is related to DNVM version. My 2 cents.Uptotheminute
Please see updated answer - I included instructions to view more details about your VM. There's still both "platform" (aka Runtime) and Architecture specified per VM.Airlike
1.0.0-beta4 mono ~/.dnx/runtimes default You are right. This is what I have. So back to my question, what is being run through mono, dnxcore50 or dnx451? How do I specify? Simply I'm trying to understand how I can run both runtimes and test a local site on the MAC with the two platforms. Any ideas? Thanks for all the information by the way. This is very helpful.Uptotheminute
I guess I found it here! adilmughal.com/blog/2015/05/setting-up-net-dev-env-on-mac Thanks for pointing me to the right direction.Uptotheminute
@EnidrusDianto The runtime will determine which framework is targeted. dnx451 is really included for backwards compatibility. It is windows only, requires the full .ne framework installed on the host, and the dnx451 runtime is little more than a shim over the existing way thing were done prior to dnx & .net 5. For non-windows environment it will always be core "something" (right now it is 50 but in the future it could be 51, 511, etc). On a windows machine there may be both coreclr and clr installed. The one that is used will depend on which one is active (in the path).Unexacting
You're mostly right, @GeraldDavis, but there's also at least mono dnvms which run more like the clr dnvms. Also, coreclr does not need to be installed anywhere once you have the published result - no external dependencies for your project!Airlike
@MattDeKrey Thanks for the update. I didn't know targeting the "full" mono bcl was supported using dnvm/dnx.Unexacting
@GeraldDavis What I'm seeing is a little bit different. I'm not able to run CoreCLR on my Mac. From what I can see there is no CoreCLR package for beta4. When I run dnvm install 1.0.0-beta4 I only get the Mono based version.Uptotheminute
@MattDeKrey This might just be an issue of terminology but the core clr (the core version of the clr) is still needed. The CLR is part of the dnx. Dnx needs to be on the target machine. Now it could be shipped with the application source or assemblies but it is still required.Unexacting
@EnidrusDianto Try using the command "dnvm install latest -r coreclr -u" and then "dnvm list". Do you have a coreclr listed? If not what errors do you get?Unexacting

© 2022 - 2024 — McMap. All rights reserved.