如何在[WindowsVolume] MyNewDir下创建子目录

时间:2015-10-30 10:22:56

标签: visual-studio wix

我想在[WindowsVolume] MyNewDir下创建两个子目录。 SubDir1和SubDir2。我是怎么做到的。以下是我的代码:

Insert into MetricsServerUserAudit(DateStamp, [TIME], [DATE], [USER_LOGIN], [USER_NAME], [MODEL_NAME], [OPERATION], [TARGET_USER],  [TARGET_GROUP], [ELEMENT_TYPE_NAME], [ELEMENT_TYPE_PERMISSION], [OBJECT_NAME], [OBJECT_PERMISSION])

1 个答案:

答案 0 :(得分:1)

您需要定义基本目录,在本例中为WindowsVolume,您可以在那里创建将使用安装程序创建的任何目录结构,然后您可以引用新目录将文件放在那里。

试试这个:

<Directory Id="TARGETDIR" Name="SourceDir">
    <Directory Id="ProgramFilesFolder">
        <Directory Id="INSTALLDIR" Name="MyProgram" />
    </Directory>
    <Directory Id="WINDOWSVOLUME" >
        <Directory Id="ANOTHERLOCATION" Name="MyNewDir">
            <Directory Id="DIR1" Name="SubDir1" />
            <Directory Id="DIR2" Name="SubDir2" />
        </Directory>
    </Directory>
      </Directory>
</Directory>

<SetDirectory Id="WINDOWSVOLUME" Value="[WindowsVolume]" />

<Feature Id="DefaultFeature" Level="1">
  <Component Directory="INSTALLDIR">
    <File Id="ApplicationFile1" Source="C:\Users\user\Desktop\myprogram.exe" />
  </Component>
  <Component Directory="DIR1">
    <File Id="ApplicationFile2" Source="C:\Users\user\Desktop\InstallerFiles_13_4_9_3\myprogramLauncher.jar" />
  </Component>
</Feature>