title: DotNet Core: Object reference not set to an instance of an object
body: <p>My project using DotNet Core was working perfectly until I updated the nuget packages to their latest version.</p>
  
  <ul>
  <li>to make the project run I had to add a global.json file (see here under)</li>
  </ul>
  
  <p><strong>I supect that the Dnx version is not correctly set and I don't know why neither how to set it correctly</strong></p>
  
  <ul>
  <li>Unfortunately there is not a single answer to my issue on github, stackoverflow nor microsoft support/community pages. The issues share the same name but are not related to my issue</li>
  </ul>
  
  <hr>
  
  <h2>Result of the build</h2>
  
  <ul>
  <li>Description: Object reference not set to an instance of an object. </li>
  <li>Project: [PROJECT NAME]</li>
  <li>File: C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\DotNet\Microsoft.DotNet.Common.Targets  </li>
  <li>Line:262 </li>
  <li>Source: Build</li>
  </ul>
  
  <p><strong>Line 262 of the  file: Microsoft.DotNet.Common.Targets</strong></p>
  
  <pre><code>&lt;Dnx
    RuntimeExe="$(SDKToolingExe)"
    Condition="'$(_DesignTimeHostBuild)' != 'true'"
    ProjectFolder="$(MSBuildProjectDirectory)"
    Arguments="$(_BuildArguments)"
    /&gt;
  </code></pre>
  
  <hr>
  
  <h2>Content of c:\Program Files\dotnet\sdk directory</h2>
  
  <ul>
  <li>1.0.0-preview1-002702 </li>
  <li>1.0.0-preview2-003121 </li>
  <li>1.0.0-preview2-003131 </li>
  <li>1.0.1 </li>
  </ul>
  
  <hr>
  
  <h2>global.json</h2>
  
  <pre><code>{
    "projects": [ "src", "test" ],
    "sdk": {
      "version": "1.0.0-preview2-003121"
    }
  }
  </code></pre>
  
  <hr>
  
  <h2>DotNet --info</h2>
  
  <pre><code>C:\[PATH]\ASPNET_Core_1_0&gt;dotnet --info
  .NET Command Line Tools (1.0.0-preview2-003121)
  
  Product Information:
   Version:            1.0.0-preview2-003121
   Commit SHA-1 hash:  1e9d529bc5
  
  Runtime Environment:
   OS Name:     Windows
   OS Version:  6.1.7601
   OS Platform: Windows
   RID:         win7-x64
  </code></pre>
  
  <hr>
  
  <h2>dnvm list</h2>
  
  <p>C:[PATH]\ASPNET_Core_1_0>dnvm list</p>
  
  <pre><code>Active Version           Runtime Architecture OperatingSystem Alias
  ------ -------           ------- ------------ --------------- -----
  *      1.0.0-rc1-update2 clr     x86          win             default
  </code></pre>
  
  <hr>
  
  <h2>project.json</h2>
  
  <pre><code>{
    "title": "Innovation Income Deduction",
    "copyright": "ALT-F1 SPRL",
    "description": "Support the Innovation Income Deduction (‘IID’) applied to income derived from intellectual property",
    "language": "en",
    "userSecretsId": "very safe secret which is not the one you read",
  
    "dependencies": {
      "Microsoft.NETCore.App": {
        "version": "1.0.1",
        "type": "platform"
      },
      "Microsoft.ApplicationInsights.AspNetCore": "1.0.0",
      "Microsoft.AspNetCore.Authentication.Cookies": "1.0.0",
      "Microsoft.AspNetCore.Diagnostics": "1.0.0",
      "Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore": "1.0.0",
      "Microsoft.AspNetCore.Identity.EntityFrameworkCore": "1.0.0",
      "Microsoft.AspNetCore.Mvc": "1.0.1",
      "Microsoft.AspNetCore.Razor.Tools": {
        "version": "1.0.0-preview2-final",
        "type": "build"
      },
      "Microsoft.AspNetCore.Routing": "1.0.1",
      "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
      "Microsoft.AspNetCore.Server.Kestrel": "1.0.1",
      "Microsoft.AspNetCore.StaticFiles": "1.0.0",
      "Microsoft.EntityFrameworkCore.SqlServer": "1.0.1",
      "Microsoft.EntityFrameworkCore.SqlServer.Design": {
        "version": "1.0.1",
        "type": "build"
      },
      "Microsoft.EntityFrameworkCore.Tools": {
        "version": "1.0.0-preview2-final",
        "type": "build"
      },
      "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
      "Microsoft.Extensions.Configuration.Json": "1.0.0",
      "Microsoft.Extensions.Configuration.UserSecrets": "1.0.0",
      "Microsoft.Extensions.Logging": "1.0.0",
      "Microsoft.Extensions.Logging.Console": "1.0.0",
      "Microsoft.Extensions.Logging.Debug": "1.0.0",
      "Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0",
      "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0",
      "Microsoft.VisualStudio.Web.CodeGeneration.Tools": {
        "version": "1.0.0-preview2-final",
        "type": "build"
      },
      "Microsoft.VisualStudio.Web.CodeGenerators.Mvc":  {
        "version": "1.0.0-preview2-final",
        "type": "build"
      }
    },
  
    "tools": {
      "BundlerMinifier.Core": "2.0.238",
      "Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview2-final",
      "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final",
      "Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview2-final",
      "Microsoft.Extensions.SecretManager.Tools": "1.0.0-preview2-final",
      "Microsoft.VisualStudio.Web.CodeGeneration.Tools": {
        "version": "1.0.0-preview2-final",
        "imports": [
          "portable-net45+win8"
        ]
      }
    },
  
    "frameworks": {
      "netcoreapp1.0": {
        "imports": [
          "dotnet5.6",
          "portable-net45+win8"
        ]
      }
    },
  
    "buildOptions": {
      "emitEntryPoint": true,
      "preserveCompilationContext": true
    },
  
    "runtimeOptions": {
      "configProperties": {
        "System.GC.Server": true
      }
    },
  
    "publishOptions": {
      "include": [
        "wwwroot",
        "**/*.cshtml",
        "appsettings.json",
        "web.config"
      ]
    },
  
    "scripts": {
      "prepublish": [ "bower install", "dotnet bundle" ],
      "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
    }
  }
  </code></pre>