title: publishing asp.net website give "Object reference not set to an instance of an object." error
body: <p>I am getting fed up with this error. I have search all over the web and tried every possible suggestion to this error I could find.</p>
  
  <ol>
  <li>delete app_code, build, add files back, publish. (did not work)</li>
  <li>delete temporary asp.net files (did not work)</li>
  </ol>
  
  <p>In the end I even tried the command line and get the following stacktrace.</p>
  
  <pre><code>error ASPRUNTIME: Object reference not set to an instance of an object.
  
  [NullReferenceException]: Object reference not set to an instance of an object.
     at System.Web.Compilation.BuildManager.CopyPrecompiledFile(VirtualFile vfile,
   String destPhysicalPath)
     at System.Web.Compilation.BuildManager.CopyStaticFilesRecursive(VirtualDirect
  ory sourceVdir, String destPhysicalDir, Boolean topLevel)
     at System.Web.Compilation.BuildManager.CopyStaticFilesRecursive(VirtualDirect
  ory sourceVdir, String destPhysicalDir, Boolean topLevel)
     at System.Web.Compilation.BuildManager.CopyStaticFilesRecursive(VirtualDirect
  ory sourceVdir, String destPhysicalDir, Boolean topLevel)
     at System.Web.Compilation.BuildManager.PrecompileAppInternal(VirtualPath star
  tingVirtualDir)
     at System.Web.Compilation.BuildManager.PrecompileApp(VirtualPath startingVirt
  ualDir)
     at System.Web.Compilation.BuildManager.PrecompileApp(ClientBuildManagerCallba
  ck callback)
     at System.Web.Compilation.BuildManagerHost.PrecompileApp(ClientBuildManagerCa
  llback callback)
     at System.Web.Compilation.BuildManagerHost.PrecompileApp(ClientBuildManagerCa
  llback callback)
     at System.Web.Compilation.ClientBuildManager.PrecompileApplication(ClientBuil
  dManagerCallback callback, Boolean forceCleanBuild)
     at System.Web.Compilation.ClientBuildManager.PrecompileApplication(ClientBuil
  dManagerCallback callback)
     at System.Web.Compilation.Precompiler.Main(String[] args)
  </code></pre>
  
  <p>I used the following command line:</p>
  
  <pre><code>aspnet_compiler.exe -p d:\code\websites\brokerweb -v / d:\code\websites\published -f -c -errorstack -u
  </code></pre>