title: ASP.NET 5 Web project and Entity Framework in separate projects
body: <p>Where to begin... This has had me all day.</p>
  
  <p>I have updated my projects to use the new ASP.NET 5 Empty Preview Template.</p>
  
  <p>I have managed to get all my projects building, but when i run my website, i get this error</p>
  
  <blockquote>
    <p>The current runtime target framework is not compatible with
    'MY.WEB.NAMESPACE'.</p>
    
    <p>Current runtime Target Framework: 'DNX,Version=v4.5.1 (dnx451)'  Type:
    CLR  Architecture: x86  Version: 1.0.0-beta5-12103</p>
    
    <p>Please make sure the runtime matches a framework specified in
    project.json</p>
  </blockquote>
  
  <p>All the examples i have seen so far, seem to have both EntityFramework in the same project, but i am using EntityFramework (currently version 6), in a separate project.  My Projects are as follows</p>
  
  <p><strong>Infrastructure</strong> - Helpful functions, referenced by any project</p>
  
  <p><strong>Entities</strong> - My POCO objects</p>
  
  <p><strong>Data</strong> - My DbContext class and other Database specific code</p>
  
  <p><strong>Service</strong> - My services to add/update entities, also references SimpleValidation 
  for my validation</p>
  
  <p><strong>Web</strong> - My web application, which consists of WebApi and angularJs.</p>
  
  <p>Now i have a project.json file for each project, which looks like so</p>
  
  <p>INFRASTRUCTURE</p>
  
  <pre><code>{
      "version": "1.0.0-*",
      "description": "my.namespace.Infrastructure",
      "authors": [ "me" ],
      "tags": [ "" ],
      "projectUrl": "",
      "licenseUrl": "",
  
      "dependencies": {
          "System.Collections": "4.0.11-beta-23225",
          "System.Linq": "4.0.1-beta-23225",
          "System.Threading": "4.0.11-beta-23225",
          "System.Runtime": "4.0.21-beta-23225",
          "Microsoft.CSharp": "4.0.1-beta-23225",
          "Humanizer": "1.37.7"
      },
  
      "frameworks": {
          "net46": { }
      }
  }
  </code></pre>
  
  <p>ENTITES (POCOS)</p>
  
  <pre><code>{
      "version": "1.0.0-*",
      "description": "my.namespace.Entities",
      "authors": [ "me" ],
      "tags": [ "" ],
      "projectUrl": "",
      "licenseUrl": "",
  
      "dependencies": {
          "System.Collections": "4.0.11-beta-23225",
          "System.Linq": "4.0.1-beta-23225",
          "System.Threading": "4.0.11-beta-23225",
          "System.Runtime": "4.0.21-beta-23225",
          "Microsoft.CSharp": "4.0.1-beta-23225"
      },
  
      "frameworks": {
          "net46": { }
      }
  }
  </code></pre>
  
  <p>DATA (DBCONTEXT)</p>
  
  <pre><code>{
      "version": "1.0.0-*",
      "description": "my.namespace.Data",
      "authors": [ "me" ],
      "tags": [ "" ],
      "projectUrl": "",
      "licenseUrl": "",
  
      "dependencies": {
          "System.Collections": "4.0.11-beta-23225",
          "System.Linq": "4.0.1-beta-23225",
          "System.Threading": "4.0.11-beta-23225",
          "System.Runtime": "4.0.21-beta-23225",
          "Microsoft.CSharp": "4.0.1-beta-23225",
          "DbExtensions": "5.1.0",
          "my.namespace.Entities": "1.0.0-*",
          "my.namespace.Infrastructure": "1.0.0-*",
          "EntityFramework": "6.1.3"
      },
  
      "frameworks": {
          "net46": { }
      }
  }
  </code></pre>
  
  <p>SERVICE</p>
  
  <pre><code>{
      "version": "1.0.0-*",
      "description": "my.namespace.Service",
      "authors": [ "me" ],
      "tags": [ "" ],
      "projectUrl": "",
      "licenseUrl": "",
  
      "dependencies": {
          "System.Collections": "4.0.10-beta-23019",
          "System.Linq": "4.0.0-beta-23019",
          "System.Threading": "4.0.10-beta-23019",
          "System.Runtime": "4.0.10-beta-23019",
          "Microsoft.CSharp": "4.0.0-beta-23019",
          "FluentValidation": "5.6.2",
          "my.namespace.Entities": "1.0.0-*",
          "my.namespace.Data": "1.0.0-*",
          "my.namespace.Infrastructure": "1.0.0-*",
          "ncalc": "1.3.8"
      },
  
      "frameworks": {
          "net46": { }
      }
  }
  </code></pre>
  
  <p>My web application, project.json looks like this</p>
  
  <pre><code>{
      "webroot": "wwwroot",
      "version": "1.0.0-*",
      "description": "my.namespace.Web",
      "authors": [ "me" ],
  
      "dependencies": {
          "Microsoft.AspNet.Server.IIS": "1.0.0-beta5",
          "Microsoft.AspNet.Server.WebListener": "1.0.0-beta5",
          "Microsoft.AspNet.Mvc": "6.0.0-beta5",
          "AutoMapper": "4.0.4"
      },
  
      "commands": {
          "web": "Microsoft.AspNet.Hosting --config hosting.ini"
      },
  
      "frameworks": {
          "dnx5": {
              "dependencies": {
                  "my.namespace.Infrastructure": "1.0.0-*",
                  "my.namespace.Entities": "1.0.0-*",
                  "my.namespace.Data": "1.0.0-*",
                  "my.namespace.Service": "1.0.0-*"
              }
          }
      },
  
      "publishExclude": [
          "node_modules",
          "bower_components",
          "**.xproj",
          "**.user",
          "**.vspscc"
      ],
      "exclude": [
          "wwwroot",
          "node_modules",
          "bower_components"
      ]
  }
  </code></pre>
  
  <p>Now this all seems to build fine, with no errors, but when i try to run, i get the above message.  I saw another post <a href="https://stackoverflow.com/a/31687529/2736022">here</a> which suggests adding an environment variable, but this doesnt seem to work. </p>
  
  <p>If i remove all the references to my other projects, comment out all code that references the other projects, and then change frameworks tag to this, the site loads.</p>
  
  <pre><code>"frameworks": {
      "dnx45": {
          "dependencies": {
  
          }
      }
  },
  </code></pre>
  
  <p>Any help would be greatly appreciated.  </p>
  
  <p>EDIT.</p>
  
  <p>Here is my project properties</p>
  
  <p><a href="https://i.stack.imgur.com/KWSbh.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KWSbh.png" alt="enter image description here"></a></p>
  
  <p>When i change to dnxcore5, i get this</p>
  
  <p><a href="https://i.stack.imgur.com/owRxC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/owRxC.png" alt="enter image description here"></a></p>
  
  <p>EDIT 2:</p>
  
  <p>I have updated all my projects to use dnx50 and dropped dnxcore50.  I still get the same error.  It must be something to do with my installation....But what i have no idea...  </p>