如何自动化WiX包装

时间:2023-01-15 11:23:13

I want to try create a set of WiX projects for each application we have. The idea is that once a developer is ready to release an updated version of an app, he/she would copy the Source files to a SourceDir, and then execute a .bat file which will execute heat.exe to get a list of files that need to be packaged, and thereafter Candle and Ligth will compile the Source into an msi.

我想为我们拥有的每个应用程序创建一组WiX项目。其想法是,一旦开发人员准备发布一个更新的应用程序版本,他/她将把源文件复制到SourceDir,然后执行一个.bat文件,该文件将执行heat。exe获取需要打包的文件列表,然后Candle和Ligth将把源编译为msi。

I also want to modify the App.config file when building the package with values public properties. Through my investigation I have figured out that I can do this using . The problem is though I need to do this by adding util:XmlFile Id="SetKey1" ... under the configuration file Componenet element.

我还想在构建带有值公共属性的包时修改App.config文件。通过我的调查,我发现我能用它来做这件事。问题是,我需要通过添加util:XmlFile Id="SetKey1"来实现这一点……在配置文件Componenet元素下。

      <Component Id="App.config" Guid="{B62F28B1-FFB3-4E93-B651-FFC7AAD4730D}">
        <File Id="App.config" KeyPath="yes" Source="SourceDir\New Folder\New Folder2\App.config" />
        <util:XmlFile Id="SetKey1"
            Action="setValue"
            ElementPath="//appSettings/add[\[]@key='Key1'[\]]/@value"
            Value="[NEWVALUE]"
            File="[#App.config]"
            SelectionLanguage="XPath"
            Sequence="1" />
      </Component>

This is no good as that bit dissapears when you run heat next time around. Is there a way to segregate the bit where the config file is modified

这是不好的,因为当你下次再加热的时候,那一点就消失了。有没有一种方法可以隔离修改配置文件的位

1 个解决方案

#1


0  

You should have at least 2 wxis. 1 would be for the main Product and contain the components and the other would be the HEATed files.

你至少应该有两个wx。一个是主产品,包含组件,另一个是加热文件。

In the main Product.wxs (or whatever you call it) can specify Directories and when you run heat you can specify a directory ref.

主要产品。wxs(或任何您称为它的)可以指定目录,当您运行热时,您可以指定一个目录ref。

ie.

ie。

<Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="INSTALLLOCATION" Name="MyApp">
        <Directory Id="WEBROOT" Name="wwwroot" />
      </Directory>
    </Directory>

When you run heat you would specify the directoryref as WEBROOT, then as long as you compile the WXS both together the files will be included.

当您运行heat时,您将指定directoryref为WEBROOT,然后只要您将WXS编译在一起,就会包含这些文件。

eg. Heat [other params] -dr WEBROOT

如。加热[其他params] - WEBROOT博士

#1


0  

You should have at least 2 wxis. 1 would be for the main Product and contain the components and the other would be the HEATed files.

你至少应该有两个wx。一个是主产品,包含组件,另一个是加热文件。

In the main Product.wxs (or whatever you call it) can specify Directories and when you run heat you can specify a directory ref.

主要产品。wxs(或任何您称为它的)可以指定目录,当您运行热时,您可以指定一个目录ref。

ie.

ie。

<Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="INSTALLLOCATION" Name="MyApp">
        <Directory Id="WEBROOT" Name="wwwroot" />
      </Directory>
    </Directory>

When you run heat you would specify the directoryref as WEBROOT, then as long as you compile the WXS both together the files will be included.

当您运行heat时,您将指定directoryref为WEBROOT,然后只要您将WXS编译在一起,就会包含这些文件。

eg. Heat [other params] -dr WEBROOT

如。加热[其他params] - WEBROOT博士