对特征元素中的组件进行排序

发布于 2024-10-08 04:11:46 字数 1016 浏览 0 评论 0原文

我想替换安装程序已安装的文件。在以下代码中,“OneCoreFiles”组件应首次安装文件(正在运行),并且组件“ConfigCopyFile”应替换该配置文件。

但代码没有按预期工作。首先执行组件“ConfigCopyFile”,然后执行“OnecoreFiles”。我希望它能以另一种方式工作。

我还在学习WIX,并认为Feature元素中的组件是按照它们声明的顺序执行的。

代码片段:

<Component Id="ConfigCopyFile" Guid="{98E61055-5A84-4003-90D1-7A67677D7465}">
  <Condition>CONFIGFILEEXISTS</Condition>
  <CopyFile Id="ConfigFileId" SourceProperty="CONFIGFILEEXISTS" DestinationProperty  ="INSTALLDIR"/>
</Component>

<Feature Id="ProductFeature" Title="OneCore Features" Level="1">
        <ComponentRef Id="LogEntries" />
        <ComponentGroupRef Id="OneCoreFiles" />
        <ComponentRef Id="AppDBConfiguration" />
        <ComponentRef Id="SqlServerConfiguration" />
        <ComponentRef Id="OracleConfiguration" />
        <ComponentRef Id="IISConfiguration" />
        <ComponentRef Id="ConfigCopyFile" />
    </Feature>

这一定很容易解决。我是不是错过了什么。请指教。

I want to replace a file that has been installed by my installer. In the following code the "OneCoreFiles" component should install the files first time( which is working) and the component "ConfigCopyFile" should replace that config file.

But the code is not working as expected. The component 'ConfigCopyFile' is getting executed first and then the 'OnecoreFiles'. I want it to work the other way.

I am still learning WIX and thought that the components in Feature elements are executed in the order in which they are declared.

Code Snippet:

<Component Id="ConfigCopyFile" Guid="{98E61055-5A84-4003-90D1-7A67677D7465}">
  <Condition>CONFIGFILEEXISTS</Condition>
  <CopyFile Id="ConfigFileId" SourceProperty="CONFIGFILEEXISTS" DestinationProperty  ="INSTALLDIR"/>
</Component>

<Feature Id="ProductFeature" Title="OneCore Features" Level="1">
        <ComponentRef Id="LogEntries" />
        <ComponentGroupRef Id="OneCoreFiles" />
        <ComponentRef Id="AppDBConfiguration" />
        <ComponentRef Id="SqlServerConfiguration" />
        <ComponentRef Id="OracleConfiguration" />
        <ComponentRef Id="IISConfiguration" />
        <ComponentRef Id="ConfigCopyFile" />
    </Feature>

This must be quite simple to solve. Am I missing something. Please advice.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

很糊涂小朋友 2024-10-15 04:11:46

您对 WiX 的看法是错误的。它不是一种脚本语言。它是一种表示 Windows Installer 数据库的方式,该数据库本质上是声明性的,而不是命令性的。如果我列出一堆组件和文件,则文件的复制顺序是不确定的。我只是说需要安装这些文件,而不是说如何安装它们。

Windows Installer 确实公开了驱动事物顺序的序列表(例如创建文件夹然后复制文件),但它不会微观管理到在该文件之前复制该文件的级别。

建议安装执行顺序

InstallExecuteSequence

You are thinking of WiX in the wrong way. It's not a scripting language. It's a way of representing Windows Installer databases which are declarative in nature not imperative. If I list a bunch of components and files it's non deterministic the order the files will be copied. I'm only saying that these files need to be installed not how to install them.

Windows Installer does expose sequence tables which drive the order of things ( such as create folders then copy files ) but it doesn't micromanage to the level of copy this file before that file.

Suggested InstallExecute Sequence

InstallExecuteSequence Table

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文