In WiX files, what does Name=“SourceDir” refer to?

前端 未结 3 1505
野趣味
野趣味 2020-11-29 22:39

WiX files always seem to include this line:


What is \"SourceDir\"? What is it used fo

3条回答
  •  萌比男神i
    2020-11-29 23:26

    From the wix.chm documentation, topic "How To: Add a File To Your Installer":

    The element with the id TARGETDIR is required by the Windows Installer and is the root of all directory structures for your installation

    According to the MSDN documentation TARGETDIR is

    the root destination directory for the installation

    Also according to MSDN, SourceDir is

    the root directory that contains the source cabinet file or the source file tree of the installation package

    So the SourceDir property points to a real directory: the one where your MSI file sits. You can see this in the installer log when installing with msiexec /lvx* installer.log installer.msi.

    However, for some reason SourceDir is completely ignored when resolving the TARGETDIR. The TARGETDIR must be either set explicitly (e.g. on the command line) or else it resolves to ROOTDRIVE. If ROOTDRIVE is not explicitly set then it is the root of the drive with the most free space.

    A quick test shows that installing a component to TARGETDIR indeed puts the files at the root of my D:\ drive, instead of the folder where the MSI sits.

提交回复
热议问题