IIS web application "Build (web): Object reference not set to an instance of an object."

Viewed 32

I inherited an old web application built using IIS, and I'm trying to figure out how to build it. I'm running into this Build (web): Object reference not set to an instance of an object. error during build time. Aren't null object references supposed to be runtime errors, not compile errors? Can anyone explain to me what's happening here and how to fix it?

enter image description here enter image description here enter image description here

1 Answers

Have you downloaded the packages your projects reference? And do the assemblies in your bin folder match up with your web.config (check version numbers too)?

Edit: If the packages in the bin folder don't match, you can redownload them with NUGET -

  1. note which packages are out of sync - grab their id values from the package nodes in the web.config

  2. Inside your VS solution, check each project's references to see where the missing packages are referenced

  3. Inside your VS solution, go to: Tools > NuGet Package Manager > Package Manager Console

  4. for each missing package run the following command in the Package Manager Console:

    Update-Package -Id <package_name> –reinstall

where <package_name> == the id value you captured from the web.config at step 1.

Related