WiX安装程序xml添加文件夹

时间:2015-06-11 12:00:31

标签: c# xml wix installer

我在stackoverflow上阅读了关于这个问题的所有主题,但我没有找到答案,因为我没有使用Visual Studio作为我的安装程序。

我有这个(config.wxs):

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Product Id="*" UpgradeCode="PUT-GUID-HERE" Version="1.0.0.0" Language="1033" Name="My Application Name" Manufacturer="My Manufacturer Name">
        <Package InstallerVersion="300" Compressed="yes"/>
        <Media Id="1" Cabinet="myapplication.cab" EmbedCab="yes" />


        <Directory Id="TARGETDIR" Name="SourceDir">
            <Directory Id="ProgramFilesFolder">
                <Directory Id="APPLICATIONROOTDIRECTORY" Name="My Application Name"/>
            </Directory>
        </Directory>


        <DirectoryRef Id="APPLICATIONROOTDIRECTORY">
            <Component Id="myapplication.exe" Guid="PUT-GUID-HERE">
                <File Id="myapplication.exe" Source="MySourceFiles\MyApplication.exe" KeyPath="yes" Checksum="yes"/>
            </Component>
            <Component Id="documentation.html" Guid="PUT-GUID-HERE">
                <File Id="documentation.html" Source="MySourceFiles\documentation.html" KeyPath="yes"/>
            </Component>
        </DirectoryRef>


        <Feature Id="MainApplication" Title="Main Application" Level="1">
            <ComponentRef Id="myapplication.exe" />
            <ComponentRef Id="documentation.html" />
        </Feature>
    </Product>
</Wix>

但我不只是文件MyApplication.exe和documentation.html,而是所有的MySourceFiles \文件夹。我尝试了一些没有成功的解决方案。

如何将MySourceFiles文件夹的所有文件都包含在我的安装程序中? 部署之后,我将使用所有文件到programfile \ my application name \ MySourceFiles \。

修改 我读了this topic,但我不明白它是如何工作的,因为我有例子:

<ItemGroup> 
... Your wxs files ...
<HarvestDirectory Include="$(variable)\MySourceFiles\">
  <ComponentGroupName>CG_YOUR_GROUP</ComponentGroupName>
  <DirectoryRefId>DIR_REFERENCE</DirectoryRefId>
  <AutogenerateGuids>false</AutogenerateGuids>
  <GenerateGuidsNow>false</GenerateGuidsNow>
  <SuppressUniqueIds>true</SuppressUniqueIds>
  <SuppressCom>true</SuppressCom>
  <SuppressRegistry>true</SuppressRegistry>
  <SuppressRootDirectory>true</SuppressRootDirectory>
  <PreprocessorVariable>var.Property_Preprocessor</PreprocessorVariable>
</HarvestDirectory>
</ItemGroup>

我可以将变量目录用于.wxs文件吗?你能开导我吗?

0 个答案:

没有答案