title: Why is ClickOnce downloading unchanged files?
body: <h3>Context:</h3>
  <p>I'm using C# and Visual Studio 2015 to develop and deploy an application with ClickOnce, and I'm trying to shrink the ClickOnce update download size.  <a href="https://msdn.microsoft.com/en-us/library/ms404267.aspx" rel="nofollow noreferrer">ClickOnce <em>is</em> capable of delta-only updates</a>:</p>
  <blockquote>
  <p>When updating an application, <em>ClickOnce compares the hash signatures of the files specified in the application manifest for the current application against the new version.</em> If different, ClickOnce downloads the new version. If the signatures match, ClickOnce copies the existing file and uses it in the new version of the application. This approach prevents ClickOnce from having to download the entire application again, even if only one or two files have changed.</p>
  </blockquote>
  <h3>Problem:</h3>
  <p>I've verified that between updates of <code>MyApp</code>, the hash signatures of most files do not change (on the command line using <code>shasum</code> or in the actual manifest files).  But ClickOnce still downloads every file on every update.</p>
  <p>For instance, <code>MyApp</code> depends upon <code>Emgu.CV.dll</code>, and I just published <code>MyApp 1.0.9.4</code> from within Visual Studio 2015.  Here is the <code>Emgu.CV.dll</code> reference from the manifest file located in the publish output location, <code>MyApp\Application Files\MyApp_1_0_9_4\MyApp.exe.manifest</code>:</p>
  <pre><code>&lt;dependentAssembly dependencyType=&quot;install&quot; allowDelayedBinding=&quot;true&quot; codebase=&quot;Emgu.CV.dll&quot; size=&quot;363520&quot;&gt;
    &lt;assemblyIdentity name=&quot;Emgu.CV&quot; version=&quot;3.0.0.2158&quot; publicKeyToken=&quot;7281126722AB4438&quot; language=&quot;neutral&quot; processorArchitecture=&quot;msil&quot; /&gt;
    &lt;hash&gt;
      &lt;dsig:Transforms&gt;
        &lt;dsig:Transform Algorithm=&quot;urn:schemas-microsoft-com:HashTransforms.Identity&quot; /&gt;
      &lt;/dsig:Transforms&gt;
      &lt;dsig:DigestMethod Algorithm=&quot;http://www.w3.org/2000/09/xmldsig#sha256&quot; /&gt;
      &lt;dsig:DigestValue&gt;lUb/oa0aQL6HWEhY8Juj6Mc1wChKo0owhJJ+sSfqZUs=&lt;/dsig:DigestValue&gt;
    &lt;/hash&gt;
  &lt;/dependentAssembly&gt;
  </code></pre>
  <p>And here is the same .dll's dependency tag from a previous deployment, <code>MyApp_1_0_9_2\MyApp.exe.manifest</code>:</p>
  <pre><code>&lt;dependentAssembly dependencyType=&quot;install&quot; allowDelayedBinding=&quot;true&quot; codebase=&quot;Emgu.CV.dll&quot; size=&quot;363520&quot;&gt;
    &lt;assemblyIdentity name=&quot;Emgu.CV&quot; version=&quot;3.0.0.2158&quot; publicKeyToken=&quot;7281126722AB4438&quot; language=&quot;neutral&quot; processorArchitecture=&quot;msil&quot; /&gt;
    &lt;hash&gt;
      &lt;dsig:Transforms&gt;
        &lt;dsig:Transform Algorithm=&quot;urn:schemas-microsoft-com:HashTransforms.Identity&quot; /&gt;
      &lt;/dsig:Transforms&gt;
      &lt;dsig:DigestMethod Algorithm=&quot;http://www.w3.org/2000/09/xmldsig#sha256&quot; /&gt;
      &lt;dsig:DigestValue&gt;lUb/oa0aQL6HWEhY8Juj6Mc1wChKo0owhJJ+sSfqZUs=&lt;/dsig:DigestValue&gt;
    &lt;/hash&gt;
  &lt;/dependentAssembly&gt;
  </code></pre>
  <p>They are identical.  Notably, <strong>the <code>&lt;hash&gt;&lt;dsig:DigestValue&gt;</code> content is identical</strong>, just like all of the other ~150MB worth of dependencies declared in their respective tags between versions <code>1.0.9.2</code> and <code>1.0.9.4</code>.</p>
  <p>Only a couple of hash values actually changed between those two manifest files.  For example, the <code>MyApp.exe</code> hash changed from</p>
  <pre><code>JryzNpD+emqeruXW7X2unRm0i58w9z9ct++Jeog40FI=
  </code></pre>
  <p>to</p>
  <pre><code>tF/hs87T4n9sMgoUJUmk31zAUsi7MsWXhLdKGxlR+EM=
  </code></pre>
  <p><strong>But a ClickOnce update from <code>1.0.9.2</code> to <code>1.0.9.4</code> downloaded <code>MyApp.exe</code> <em>and</em> <code>Emgu.CV.dll</code> <em>and</em> every other file, changed or not!</strong></p>
  <p><strong>Why is ClickOnce downloading files whose hash hasn't changed?</strong></p>
  <hr />
  <h3>Research so far:</h3>
  <p><a href="https://stackoverflow.com/questions/3554819/clickonce-updates-all-files-why">This SO question</a> is related, but the answer isn't applicable because I'm not rebuilding the assemblies that are being redundantly downloaded, they're just being copied (as is evident from the unchanging hash signatures).</p>
  <p><a href="https://stackoverflow.com/questions/11511609/clickonce-copy-if-newer-always-download-the-file">This SO question</a> is related, but the asker simply misunderstood what &quot;Copy if Newer&quot; meant.</p>
  <p>I've read <a href="https://msdn.microsoft.com/en-us/library/ms229001.aspx" rel="nofollow noreferrer">this troubleshooting MSDN page</a>, my problem doesn't appear.</p>