Using WiX File Names

I copy the file to a directory and then set the environment variable pointing to this file. However, this works, I have to hardcode the file name (I cannot reuse what I already have). Here is an example:

<Directory Id="CUSTOM_DIRECTORY" Name="Directory">
   <Component Id="Framework" Guid="YOURGUIDIDHERE">
      <File Id="FrameworkJAR" Name="framework.jar" DiskId="1" Source="framework.jar" KeyPath="yes" />
      <Environment Id="FrameworkVar" Name="CLASSPATH" Action="set" Permanent="no" Part="last" System="yes" Value="[CUSTOM_DIRECTORY]framework.jar" />
    </Component>
    </Component>
</Directory>

As you can see, in the Value attribute I can enter [CUSTOM_DIRECTORY], which will give me the full path to the directory, but I still have to manually output framework.jar. Is it possible to simply use something like Value = "[FrameworkJAR]" to get the full path to install the JAR file?

Thanks.

+3
source share
1 answer

Yes this:)

See the documentation for type Formatted . Just use ...

Value="[#FrameworkJAR]"

:

... [#filekey] , filekey . [#filekey] CostInitialize action, FileCost action CostFinalize....

+3

Source: https://habr.com/ru/post/1716631/


All Articles