Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/wix/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Visual studio 如何使用Visual Studio为WIX合并模块的内容设置特定位置_Visual Studio_Wix_Windows Installer_Merge Module - Fatal编程技术网

Visual studio 如何使用Visual Studio为WIX合并模块的内容设置特定位置

Visual studio 如何使用Visual Studio为WIX合并模块的内容设置特定位置,visual-studio,wix,windows-installer,merge-module,Visual Studio,Wix,Windows Installer,Merge Module,我正在制作一个msi,它将2个插件安装到用户的漫游文件夹,并将一个文件夹(+其内容)安装到计算机上的特定位置:C:\UMI\temp。对于这两个插件,一切都很好。我的问题出在文件夹上。首先,我需要测试该位置是否存在,然后将内容移动到该位置 按照我的设置方式,我使用Heat.exe在合并模块中获取文件夹的内容。然后在我的WIX项目文件中引用合并模块 这是有问题的合并模块的内容: <?xml version="1.0" encoding="UTF-8"?> <Wix xmlns="

我正在制作一个msi,它将2个插件安装到用户的
漫游
文件夹,并将一个文件夹(+其内容)安装到计算机上的特定位置:
C:\UMI\temp
。对于这两个插件,一切都很好。我的问题出在文件夹上。首先,我需要测试该位置是否存在,然后将内容移动到该位置

按照我的设置方式,我使用Heat.exe在合并模块中获取文件夹的内容。然后在我的WIX项目文件中引用合并模块

这是有问题的合并模块的内容:

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Module Id="TempFilesMM" Language="1033" Version="1.0.0.0">
        <Package Id="9f5b21ce-db22-40aa-a2f6-f82ed89958a5" Manufacturer="Some Company" InstallerVersion="200" InstallScope="perMachine"/>

        <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="MergeRedirectFolder">
        <Directory Id="INSTALLLOCATION" Name="HarvestSetup">
          <Directory Id="TempFilesComponentGroup">
          </Directory>
          </Directory>

      </Directory>
        </Directory>
    <ComponentGroupRef Id ="TempFilesComponentGroup"/>
    </Module>
</Wix>

知道
TempFilesComponentGroup
是对收获的.wxs文件的引用,我认为INSTALLLOCATION是安装期间复制内容的目录。事实上,在安装时,它会在
C:\
目录的根目录上创建一个名为HarvestSetup的文件夹。我希望它安装在
C:\UMI\temp
中,而不使用名为
harvedsetup
的文件夹,并测试该位置是否预先存在。有什么建议吗

非常感谢

使用检查文件夹是否存在:

<Property Id="EXISTING_INSTALLLOCATION">
    <DirectorySearch Id="Search_EXISTING_INSTALLLOCATION" Path="C:\UMI\temp"/>
</Property>

您希望安装到硬编码路径似乎有点奇怪,但假设您有一个很好的理由

仅当该目录存在时,在组件条件中使用该目录搜索分配的属性来安装文件

<Component Id="SomeComponentId" Guid="SomeGUID" Directory="EXISTING_INSTALLLOCATION">
    <File Id="SomeFileId" Source="SomeSource"/>
    <Condition>EXISTING_INSTALLLOCATION</Condition> 
</Component>

现有安装位置