【问题标题】:How to create 2 folders inside a subfolder using wix如何使用 wix 在子文件夹中创建 2 个文件夹
【发布时间】:2017-02-06 18:06:36
【问题描述】:

刚开始接受 WIX,我正在尝试为我的 c# wpf 应用程序创建一个安装程序。

我想在我在 programdata 文件夹中创建的子文件夹中创建 2 个文件夹。

以下代码将仅创建 1 个文件夹“数据”而不是“日志”。

请问我做错了什么?

谢谢

<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="EmptyFolderExample" Language="1033" Version="1.0.0.0" Manufacturer="WixExamples" UpgradeCode="b9f6f617-7d4c-4b9a-a165-24bd869ce1e9">
    <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />

    <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
    <MediaTemplate EmbedCab="yes" />

    <Feature Id="ProductFeature" Title="EmptyFolderExample" Level="1">
        <ComponentGroupRef Id="ProductComponents" />
    </Feature>
</Product>

<Fragment>
    <Directory Id="TARGETDIR" Name="SourceDir">
        <Directory Id="CommonAppDataFolder">
    <Directory Id="INSTALLFOLDER" Name="InformedWorker">
      <Directory Id="EmptyDataFolderDir" Name="Data" />
      <Directory Id="EmptyLogFolderDir" Name="Log" />
    </Directory>
        </Directory>
    </Directory>
</Fragment>



<Fragment>
    <ComponentGroup Id="ProductComponents" Directory="EmptyDataFolderDir">
  <Component Id="CMP_MyEmptyDataDir"
         Guid="85DAD4AE-6404-4A40-B713-43538091B9D3"
         KeyPath="yes">
    <CreateFolder />
  </Component>
</ComponentGroup>
</Fragment>

<Fragment>
<ComponentGroup Id="ProductComponents2" Directory="EmptyLogFolderDir">
  <Component Id="CMP_MyEmptyLogDir"
    Guid="a4594ec9-3101-4627-8ee7-d60d0a9b1f63"
    KeyPath="yes">
    <CreateFolder />
  </Component>
 </ComponentGroup>
</Fragment>

【问题讨论】:

    标签: wix wix3.6


    【解决方案1】:

    您需要添加一个具有 Directory="EmptyLogFolderDir" 的组件,就像您为数据所做的那样。

    【讨论】:

    • 嗨,是的,我已经这样做了。它没有出现在我原来的问题中,因为缩进是错误的。现在更正/编辑它。但这对我不起作用:(
    • 在功能下添加
    猜你喜欢
    • 1970-01-01
    • 2021-05-27
    • 2020-06-05
    • 1970-01-01
    • 2018-12-02
    • 1970-01-01
    • 1970-01-01
    • 2023-04-02
    • 2014-01-17
    相关资源
    最近更新 更多