如何在Wix中引用heat.exe生成的wxs文件中的File元素 [英] How to reference File element inside wxs file generated by heat.exe in Wix

查看:135
本文介绍了如何在Wix中引用heat.exe生成的wxs文件中的File元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将为我的Web项目创建安装程序.我使用 http://blog.bartdemeyer.be/2013/10/create-an-installer-for-website-with-wix-part-1/作为我的参考.在本文的中间,作者使用heat.exe创建了一个名为WebSiteContent.wxs的文件:

I am going to create setup for my web project. I use http://blog.bartdemeyer.be/2013/10/create-an-installer-for-website-with-wix-part-1/ as my reference. In the middle of article, author create a file called WebSiteContent.wxs using heat.exe:

<Target Name="Harvest">
<!-- Harvest all content of published result -->
<Exec
    Command='$(WixPath)heat dir $(Publish) -dr INSTALLFOLDER -ke -srd -cg MyWebWebComponents -var var.publishDir -gg -out $(WebSiteContentCode)'
    ContinueOnError="false"
    WorkingDirectory="." />
</Target>

在运行msbuild之后,文件包含以下内容:

After runnig msbuild, file conitains following content:

<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
  <!--...-->
  <Fragment>
    <ComponentGroup Id="MyWebWebComponents">
      <!--...-->
      <Component Id="cmpCDB7F4EFDEF1E65C3B12BEBAD7E4D7EA" Directory="INSTALLFOLDER" Guid="{7EA5DB39-513D-482B-9FDC-2F16FCE5E712}">
        <File Id="fil8994620207C22CA15AF75ACDD6420C79" KeyPath="yes" Source="$(var.publishDir)\Web.config" />
      </Component>
    </ComponentGroup>
  <!--...-->
  </Fragment>
</Wix>

我要更改web.config文件内容的值,如更改XML节点中所述来自WiX 的值,但我不知道如何将WebSiteContent.wxs文件外部的引用添加到fil8994620207C22CA15AF75ACDD6420C79元素.

I want to change value of web.config file content as described in Change XML node values from WiX but I don't know how to add reference outside of WebSiteContent.wxs file to fil8994620207C22CA15AF75ACDD6420C79 element.

我知道我可以将xml脚本添加到WebSiteContent.wxs文件中.但是因为在每个构建版本中都会对其进行清理,所以我不想在每个构建版本中都更改WebSiteContent.wxs文件.

I know I can add xml script to WebSiteContent.wxs file. But because in every build it will be cleaned, I don't want to change WebSiteContent.wxs file in every build.

推荐答案

在属性中使用带有#前缀的文件ID,如您所引用的示例所示.由热量产生的文件ID在其位置规范方面是稳定的.

Use the file id with the # prefix in a property as shown in the example you referenced. File ids generated by heat are stable with respect to their location specification.

如果这使它不可读,则可以通过加热和XSL将文件ID更改为固定值.

If that makes it unreadable, you can give heat and XSL to change the file id to a fixed value.

这篇关于如何在Wix中引用heat.exe生成的wxs文件中的File元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆