title: ClickOnce deployment with MSBuild -> How to pass the current build number for application version/ or autoincrement
body: <p>We have an Outlook add-in which is using ClickOnce deployment.</p>
  
  <p>Once the developer check in the build, the PC queues a build and the application is published to a location on a shared drive.</p>
  
  <p>The problem is that the build does not change the publish version to the current assembly version and therefore it publishes in the previous version's folder which results in a corrupted installer saying that the version cannot be installed.</p>
  
  <p>I've read <a href="https://stackoverflow.com/questions/8482360/how-can-i-get-msbuild-to-increment-clickonce-publish-revision-version-number-on">that article</a>. And I set up [assembly: AssemblyVersion("1.0.*")]. Still nothing.</p>
  
  <p>I figured out a way to work around this problem by incrementing the <code>&lt;ApplicationVersion&gt;&lt;/ApplicationVersion&gt;</code> in the *.csproj file. But I want it to be automated.</p>
  
  <p>The other workaround was when executing msbuild.exe:</p>
  
  <pre><code>/target:publish   /property:PublishDir="\\sharedDir\\" /property:GenerateManifests=true
  /property:ApplicationVersion=1.0.0.123
  </code></pre>
  
  <p>And still it is not automated. I really would like to pass the current build number either to the msbuild.exe or on every build replace the value in <code>&lt;ApplicationVersion&gt;&lt;/ApplicationVersion&gt;</code> with the actual build number. Or is there another way?</p>