WIX - Getting source files from an environment variable path
I'am new to WIX, trying to create an msi with feature tree.
- The installer should install all the assemblies in folder
C:\ProgramFile\MyDir\MyApp
. Reading path from an environment variable called
MyFolder
.<WixVariable Id ="MyFolder" Value="[%MyFolder]"/>
Below is the code from where the assemblies are read.
<Directory Id="TARGETDIR" Name="SourceDir"> <Directory Id="ProgramFilesFolder" Name="ProgramFilesFolder"> <Directory Id="ProgramFilesFolder.MyDIR" Name="MyDIR"> <Directory Id="PROGRAMFILESFOLDER.MyDIR.MyApp" Name="MyApp"> <Component Id="Component.aaa.dll" Guid="guid1"> <File Id="aaa.dll" Source="..\..\OutPut\aaa.dll" /> </Component>
Now I would like to get the assemblies from the folder
MyFolder
which is an environment variable and append it to my Source<Directory Id="MyFolder" Name="MyFolder" SourceName="MyFolder"> <Component Id="Component.bbb.exe" Guid="guid2"> <File Id="bbb.exe" Name="bbb.exe" Vital=开发者_如何学JAVA"yes" Source=MyFolder + bbb.exe /> </Component> </Directory>
I receive a compilation error saying it is unable to find bbb.exe.
Please let me know on where I'm going wrong.
See the Preprocessor documentation. I think you can simply do this to get bbb.exe from a path defined in an environment variable:
<File Id="bbb.exe" Name="bbb.exe" Vital="yes" Source="$(env.MyFolder)bbb.exe" />
精彩评论