Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>We use Team Foundation Server Team Build and have added a block to the TFSBuild.proj's <code>AfterCompile</code> target to trigger the ClickOnce publish with our preferred version number:</p> <pre class="lang-xml prettyprint-override"><code>&lt;MSBuild Projects="$(SolutionRoot)\MyProject\Myproject.csproj" Properties="PublishDir=$(OutDir)\myProjectPublish\; ApplicationVersion=$(PublishApplicationVersion); Configuration=$(Configuration);Platform=$(Platform)" Targets="Publish" /&gt; </code></pre> <p>The <code>PublishApplicationVersion</code> variable is generated by a custom MSBuild task to use the TFS Changeset number, but you could use <a href="http://msdn.microsoft.com/en-us/library/t9883dzc.aspx" rel="nofollow noreferrer">your own custom task</a> or an <a href="http://msbuildtasks.tigris.org/" rel="nofollow noreferrer">existing solution</a> to get the version number from the AssemblyInfo file.</p> <p>This could theoretically be done in your project file (which is just an MSBuild script anyway), but I'd recommend against deploying from a developer machine.</p> <p>I'm sure other <a href="http://en.wikipedia.org/wiki/Continuous_integration" rel="nofollow noreferrer">continuous integration</a> (CI) solutions can handle this similarly.</p> <hr> <p><strong>Edit:</strong> Sorry, got your question backwards. Going from the ClickOnce version number to the AssemblyInfo file should be doable. I'm sure the MSBuild Community Tasks (link above) have a task for updating the AssemblyInfo file, so you'd just need a custom task to pull the version number from the ClickOnce configuration XML.</p> <p>However, you may also consider changing your error reporting to include the ClickOnce publish version too:</p> <pre class="lang-cs prettyprint-override"><code>if (System.Deployment.Application.ApplicationDeployment.IsNetworkDeployed) { Debug.WriteLine(System.Deployment.Application.ApplicationDeployment. CurrentDeployment.CurrentVersion); } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload