Search code examples
visual-studio-2015asp.net-corednx

Switch DNX Version in Visual Studio 2015?


I started a new web project using dnu and dnx. I was able to open it in Visual Studio and all was working great. Now I installed the Facebook SDK nuget package, but it isn't compatible with DNX Core 5.0. I have two sets of references, one for DNX Core 5.0 and one for DNX 4.5.1. When I compile I get errors because the types can't be found, although I can enter them fine in code and intellisense works.

I can't find anywhere where the version is set. In global.json it says my version is '1.0.0-rc1-final' which looks like 'clr' runtime, not 'coreclr'. Does that mean it's 4.5.1? It seems to have no relation to those versions.

dnvm versions

Looking in project.json I see facebook is there only for framework 'dnx451', if I add it to 'dnxcore50' then I get an error that Facebook 7.0.6 does not support DNXCore, Version=v5.0.

"frameworks": {
  "dnx451": {
    "dependencies": {
      "Facebook": "7.0.6"
    }
  },
  "dnxcore50": {
    "dependencies": {
      "Facebook": "7.0.6"
    }
  }
},

A search of the entire project finds that this is the only place those strings exist. Doing a recursive grep from the command line shows there are many lines with those strings in the paths (i.e. lib/dnxcore50/). The parent seems to be DNXCore,Version=v5.0.

Doing a full search for DNX I find web config has an httpPlatform entry:

    <httpPlatform processPath="%DNX_PATH%"
         arguments="%DNX_ARGS%"
         stdoutLogEnabled="false"
         forwardWindowsAuthToken="false"
         startupTimeLimit="3600" />

How do I tell my project to use framework dnx451?


Solution

  • If you keep referencing dnxcore50 as a possible target framework Visual Studio will prevent you from building unless all the referenced packages are compatible with it. It tries to ensure that you can run the application on both of the frameworks.

    You can simply remove the dnxcore50 from the frameworks to remove the dependencies and make sure you're always building for dnx451.

    "frameworks": {
      "dnx451": {
        "dependencies": {
          "Facebook": "7.0.6"
        }
      }
    },