Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>One way would be to define the variables in your MSBuild script, and have it update Defines.wxi at build time, as in <a href="https://web.archive.org/web/20140301225546/http://tranxcoder.wordpress.com/2008/07/03/a-custom-task-for-building-wix-under-msbuild-tfs/" rel="nofollow">this example</a>.</p> <p>In your MSBuild script, you could define the version properties as follows:</p> <pre><code> &lt;PropertyGroup&gt; &lt;MajorVersion&gt;1&lt;/MajorVersion&gt; &lt;MinorVersion&gt;08&lt;/MinorVersion&gt; &lt;BuildVersion&gt;11&lt;/BuildVersion&gt; &lt;WixConfigPath&gt;.\Defines.wxi&lt;/WixConfigPath&gt; &lt;_VariableDefinitions&gt; &lt;Root&gt; &lt;VariableDefinition Name="MajorVersion" NewValue="$(MajorVersion)" /&gt; &lt;VariableDefinition Name="MinorVersion" NewValue="$(MinorVersion)" /&gt; &lt;VariableDefinition Name="BuildVersion" NewValue="$(BuildVersion)" /&gt; &lt;/Root&gt; &lt;/_VariableDefinitions&gt; &lt;/PropertyGroup&gt; &lt;Target Name="UpdateWixVars"&gt; &lt;WixVarSubstitution SourceFile="$(WixConfigPath)" VariableDefinitions="$(_VariableDefinitions)"/&gt; &lt;/Target&gt; </code></pre> <p>Then running the UpdateWixVars target will update the version numbers in Defines.wxi with the version numbers specified in your MSBuild project.</p> <p>Note that I could not find an actual compiled dll with this custom build task, so I had to create it by:</p> <ol> <li>Download the source <a href="http://www.hempel.cx/Misc/WixVarSubstitution.cs" rel="nofollow">from here</a>. Build it and name the file Tranxition.BuildTasks.dll.</li> <li><p>Add the reference to the build task like so:</p> <pre><code>&lt;UsingTask TaskName="WixVarSubstitution" AssemblyFile="$(MSBuildExtensionsPath)\Tranxition\Tranxition.BuildTasks.dll"/&gt; </code></pre></li> </ol>
 

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