Nate Barbettini
Nate Barbettini

Reputation: 53600

dotnet build produces NullReferenceException

I made a change to a known working project and now I get the following when building with dotnet build:

λ dotnet build
Object reference not set to an instance of an object.

The change was adding a new framework to the frameworks section, which has worked in the past. I'm not sure why it suddenly stopped working.

Upvotes: 2

Views: 380

Answers (1)

Nate Barbettini
Nate Barbettini

Reputation: 53600

This is a known bug in the dotnet CLI. It happens if you add a new framework to project.json but don't run dotnet restore.

Restoring first fixes the issue:

λ dotnet restore

log  : Restore completed in 2138ms.

λ dotnet build

Compilation succeeded.
    0 Warning(s)
    0 Error(s)

Upvotes: 3

Related Questions