title: Build succeeds, but publish fails
body: <p>Up until two days ago, I was able to use Visual Studio 2010's "Publish Web" option by right clicking on my project and clicking the publish button on the context menu. Now when I try to do the same thing, I get the following output:</p>
  
  <pre><code>------ Build started: Project: ELMS, Configuration: Debug Any CPU ------
  Build started 8/1/2011 3:08:03 PM.
  GenerateTargetFrameworkMonikerAttribute:
  Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output files are
  up-to-date with respect to the input files.
  _CopyOutOfDateSourceItemsToOutputDirectoryAlways:
  Copying file from "C:\SVN\TrakNet\trunk\MTS\lib\Newtonsoft.Json.Net35.dll" to 
    "bin\lib\Newtonsoft.Json.Net35.dll".
  CopyFilesToOutputDirectory:
    LMS -&gt; C:\SVN\TrakNet\trunk\MTS\bin\LMS.dll
  
  Build succeeded.
  
  Time Elapsed 00:00:00.04
  ------ Publish started: Project: LMS, Configuration: Debug Any CPU ------
  Object reference not set to an instance of an object.
  ========== Build: 1 succeeded or up-to-date, 0 failed, 0 skipped ==========
  ========== Publish: 0 succeeded, 1 failed, 0 skipped ==========
  </code></pre>
  
  <p>This is while attempting to publish to localhost (for debugging purposes)</p>
  
  <p>Here are the settings of the publish profile that I'm using:</p>
  
  <pre><code>Publish Method: Web Deploy
  Service URL: localhost
  Site/application: default web site/ELMS
  [x] Mark as IIS application on destination
  [x] Leave extra files on destination (do not delete)
  </code></pre>
  
  <p>I have already attempted:</p>
  
  <pre><code>- Cleaning/rebuilding the project
  - Deleting the bin folder of the project
  - Running reg_iis.exe -i
  - Reinstalling VS2010
  </code></pre>
  
  <p>but nothing I've changed has fixed the error.</p>
  
  <p>Any insight into what might be causing the issue would be greatly appreciated :)</p>
  
  <p>EDIT:</p>
  
  <p>The problem actually resolved itself as of my last reboot. I must have rebooted 6-7 times since the problem first manifested itself, but this time no Object Reference message. Here's the log from the build/publish now:</p>
  
  <pre><code>------ Build started: Project: LMS, Configuration: Debug Any CPU ------
  Build started 8/3/2011 9:10:12 AM.
  GenerateTargetFrameworkMonikerAttribute:
  Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output files are up-to-date with respect to the input files.
  _CopyOutOfDateSourceItemsToOutputDirectoryAlways:
    Copying file from "C:\SVN\TrakNet\trunk\MTS\lib\Newtonsoft.Json.Net35.dll" to "bin\lib\Newtonsoft.Json.Net35.dll".
  CopyFilesToOutputDirectory:
    LMS -&gt; C:\SVN\TrakNet\trunk\MTS\bin\LMS.dll
  
  Build succeeded.
  
  Time Elapsed 00:00:00.04
  ------ Publish started: Project: LMS, Configuration: Debug Any CPU ------
  Gather all files from Project items @(IntermediateAssembly). Adding:
  bin\LMS.dll to bin\LMS.dll
  bin\LMS.pdb to bin\LMS.pdb
  Gather all files from Project items @(Content). Adding:
  Global.asax;lib\Newtonsoft.Json.Net35.dll;MtsSchemas\MtsSchema.xml;Web.config
  Gather all files from Project output (IntermediateSatelliteAssembliesWithTargetPath).
  Adding:
  Gather all files from Project items
  @(ReferenceCopyLocalPaths,ReferenceComWrappersToCopyLocal,ResolvedIsolatedComModules,_DeploymentLooseManifestFile,NativeReferenceFile).
  Gather all files from Project items @(AllExtraReferenceFiles). Adding:
  Gather all files from Project items
  @(_SourceItemsToCopyToOutputDirectoryAlways,_SourceItemsToCopyToOutputDirectory). Adding:
  bin\lib\Newtonsoft.Json.Net35.dll
  Gather all files from Project items @(_binDeployableAssemblies). Adding:
  Publish Pipeline Collect Files Phase
  Found The following for Config tranformation:
  Web.config
  Creating directory "C:\SVN\TrakNet\trunk\MTS\obj\Debug\TransformWebConfig\transformed\".
  Publish Pipeline Transform Phase
  Creating directory "C:\SVN\TrakNet\trunk\MTS\obj\Debug\CSAutoParameterize\transformed\".
  Copying Web.config to obj\Debug\CSAutoParameterize\original\Web.config.
  Transforming Source File: C:\SVN\TrakNet\trunk\MTS\Web.config
    Applying Transform File: &lt;?xml version="1.0"?&gt;
          &lt;configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform"&gt;
            &lt;connectionStrings&gt;
              &lt;add
                connectionString="{% token='$(ReplacableToken_#(parameter)_#(tokennumber))' xpathlocator='name' parameter='$(name)-Web.config Connection String' description='$(name) Connection String used in web.config by the application to access the database.' defaultValue='$(connectionString)' tags='SqlConnectionString' %}"
                xdt:Transform="SetTokenizedAttributes(connectionString)" xdt:SupressWarnings="True" /&gt;
            &lt;/connectionStrings&gt;
          &lt;/configuration&gt;
        Output File: obj\Debug\CSAutoParameterize\transformed\Web.config
      Transformation succeeded
  Auto ConnectionString Transformed Web.config into obj\Debug\CSAutoParameterize\transformed\Web.config.
  Creating directory "obj\Debug\Package\PackageTmp".
  Copying all files to temporary location below for package/publish:
  obj\Debug\Package\PackageTmp.
  Copying bin\LMS.dll to obj\Debug\Package\PackageTmp\bin\LMS.dll.
  Copying bin\LMS.pdb to obj\Debug\Package\PackageTmp\bin\LMS.pdb.
  Copying Global.asax to obj\Debug\Package\PackageTmp\Global.asax.
  Copying lib\Newtonsoft.Json.Net35.dll to obj\Debug\Package\PackageTmp\lib\Newtonsoft.Json.Net35.dll.
  Copying MtsSchemas\MtsSchema.xml to obj\Debug\Package\PackageTmp\MtsSchemas\MtsSchema.xml.
  Copying C:\SVN\TrakNet\trunk\MTS\lib\Newtonsoft.Json.Net35.dll to obj\Debug\Package\PackageTmp\bin\lib\Newtonsoft.Json.Net35.dll.
  Copying obj\Debug\CSAutoParameterize\transformed\Web.config to obj\Debug\Package\PackageTmp\Web.config.
  Publish Pipeline Deploy phase Pre-Deploy CopyAllFilesToOneFolder Stage
  Generate source manifest file for Web Deploy package/publish ...
  Creating directory "obj\Debug\Database".
  Starting Web deployment task from source:manifest(C:\SVN\TrakNet\trunk\MTS\obj\Debug\Package\LMS.SourceManifest.xml) to Destination:auto().
  Updating filePath (default web site/LMS\bin\ELMS.dll).
  Updating filePath (default web site/LMS\bin\ELMS.pdb).
  Updating filePath (default web site/LMS\bin\lib\Newtonsoft.Json.Net35.dll).
  Updating filePath (default web site/LMS\lib\Newtonsoft.Json.Net35.dll).
  Updating filePath (default web site/LMS\Web.config).
  Updating setAcl (default web site/LMS).
  Updating setAcl (default web site/LMS).
  Successfully executed Web deployment task.
  Publish is successfully deployed.
  ========== Build: 1 succeeded or up-to-date, 0 failed, 0 skipped ==========
  ========== Publish: 1 succeeded, 0 failed, 0 skipped ==========
  </code></pre>
  
  <p>Like I said: No idea what changed. I had been manually moving the DLLs into the website's virtual directory, then just for kicks I tried publishing this morning, and everything worked out fine.</p>