开发者

how to auto-select source file when build a install packet

开发者 https://www.devze.com 2023-02-10 06:37 出处:网络
i have the followin开发者_开发百科g requirement: two folders A and B, for file a, if it exists in A, we build it into our install packet, otherwise we use file a in folder B as the default selection.

i have the followin开发者_开发百科g requirement: two folders A and B, for file a, if it exists in A, we build it into our install packet, otherwise we use file a in folder B as the default selection. how to implement this? please help.


I would say this job should be split between WiX and your build engine. Moreover, the most of the responsibility goes to build engine.

In WiX you can author the file in question (let's call it a.txt) in the following way (it's a child of a Component element):

  <File Id="myfile" KeyPath="yes" Source="$(var.DataFolder)\a.txt" />

Having that, you should pass the value of DataFolder variable to candle.exe (the compiler of WiX). This can be done in a couple of ways, via the command line or via the project settings (if you author *.wixproj). Let's say, you're doing it with the first option and your build engine is NAnt:

  <candle out="${out}\\" rebuild="true">
     <defines>
        ...
        <define name="DataFolder" value="${data.folder}" />
        ...
     </defines>
     <sources basedir="${dir}">
        <include name="**.wxs"/>
     </sources>
  </candle>

Note that it's just a sample for you to get the idea. WiX is also friendly with MSBuild.

The build engine is then responsible for picking up the correct ${data.folder}, whch is either A or B in your case.

0

精彩评论

暂无评论...
验证码 换一张
取 消