Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<h2>Updating the <code>MinimumRequiredVersion</code> Automatically</h2> <h3>Introduction to Project Editor</h3> <ol> <li><p>In Solution Explorer, right click on your project and select unload project.</p> <p><img src="https://i.stack.imgur.com/7nAnm.png" alt="Screenshot of Unloading"></p></li> <li><p>Once the project has become unavailable, right click again and select edit <em><code>&lt;project_name&gt;.&lt;lang&gt;</code></em> proj.</p> <p><img src="https://i.stack.imgur.com/bgcUL.png" alt="Screenshot of Opening Editor"></p></li> </ol> <h3>Introduction to MSBuild</h3> <ol start="3"> <li><p>Properties use key/value pairs to extract information</p> <ul> <li>Using the property name as an alias, you can use <code>$(OutputPath)</code> to obtain the value for the element <code>&lt;OutputPath&gt;.\bin&lt;/OutputPath&gt;</code></li> </ul></li> <li><p>We’ll use the following properties generated for a ClickOnce deployment</p> <pre class="lang-xaml prettyprint-override"><code>&lt;MinimumRequiredVersion&gt;1.0.0.6&lt;/MinimumRequiredVersion&gt; &lt;ApplicationRevision&gt;7&lt;/ApplicationRevision&gt; &lt;ApplicationVersion&gt;1.0.0.%2a&lt;/ApplicationVersion&gt; </code></pre></li> <li><p><code>MSBuild Tasks</code> can be specified in the project (*.proj) file and invoked during a build event.</p> <ul> <li><a href="http://msdn.microsoft.com/en-us/library/ff595162.aspx" rel="nofollow noreferrer"><code>FormatVersion</code></a> is a built-in task for .NET 4.0 and later that formats the ApplicationVersion and ApplicationRevision into a single version number.</li> </ul></li> </ol> <h3>Implementation</h3> <ol start="6"> <li><p>Copy and Paste the following code into the opened project file as a child element to the root <code>&lt;Project&gt;</code> element.</p> <pre class="lang-xaml prettyprint-override"><code>&lt;Target Name="AutoSetMinimumRequiredVersion" BeforeTargets="GenerateDeploymentManifest"&gt; &lt;FormatVersion Version="$(ApplicationVersion)" Revision="$(ApplicationRevision)"&gt; &lt;Output PropertyName="MinimumRequiredVersion" TaskParameter="OutputVersion" /&gt; &lt;/FormatVersion&gt; &lt;FormatVersion Version="$(ApplicationVersion)" Revision="$(ApplicationRevision)"&gt; &lt;Output PropertyName="_DeploymentBuiltMinimumRequiredVersion" TaskParameter="OutputVersion" /&gt; &lt;/FormatVersion&gt; &lt;/Target&gt; </code></pre> <p>This code will take ApplicationVersion and ApplicationRevision as parameters in the Format Version task and will save the output by overwriting the MinimumRequiredVersion with the full publish version.</p></li> <li><p>Save and reload your project. Every ClickOnce deployment will now automatically update to the most recently published version.</p></li> </ol> <hr> <p><em>Many thanks to Kev for <a href="https://stackoverflow.com/a/13483142/1366033">their answer</a> which I have basically rehashed here with a little bit of added clarification for any beginners.</em> Here's a <a href="http://www.codingeverything.com/2013/05/automatically-increment-minimum.html" rel="nofollow noreferrer">blog post</a> I made about the issue that expands even more on my answer here.</p>
 

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