Creating folders on wix

I want to create a folder on drive C, and then create several subfolders inside this folder in wix installer. But these folders are not related to the installed folder. My program wants to install in the AServiceSetup folder ... but I want to create the "PTLogFile" folder inside the C drive, and then I want to create some subfolders inside this folder. Please help me fix my code. Next is my code

<Directory Id="TARGETDIR" Name="SourceDir"> <Directory Id="PTLogFile" Name="PTLogFile"> <Directory Id="Backups" Name="Backups"/> <Directory Id="CommandLog" Name="CommandLog"/> <Directory Id="EventLog" Name="EventLog"/> <Directory Id="Responds" Name="Responds"/> </Directory> <Directory Id="ProgramFilesFolder"> <Directory Id="INSTALLFOLDER" Name="AServiceSetup"> </Directory> </Directory> </Directory> </Fragment> 
+6
source share
3 answers

Thank you for your responses. I got a response from the above answers. The directory structure is as follows

  <Directory Id="TARGETDIR" Name="SourceDir"> <Directory Id="LogFile" Name="LogFile"> <Directory Id="Logs" Name="Logs"> <Directory Id="Log1" Name="Log1"/> <Directory Id="Log2" Name="Log2"/> <Directory Id="Log3" Name="Log3"/> <Directory Id="Log4" Name="Log4"/> </Directory> </Directory> <Directory Id="ProgramFilesFolder"> <Directory Id="INSTALLFOLDER" Name="AServiceSetup"> </Directory> </Directory> </Directory> 

And Component as follows

  <Component Id="CreateLogFolders" Guid="....." Directory="LogFile" > <CreateFolder Directory="LogFile" /> <CreateFolder Directory="Logs"/> <CreateFolder Directory="Log1"/> <CreateFolder Directory="Log2"/> <CreateFolder Directory="Log3"/> <CreateFolder Directory="Log4"/> </Component> 

and this link to the component inside the product function as follows

  <ComponentRef Id="CreateLogFolders"/> 

Finally, add the property inside the product as follows:

  <Property Id="LogFile" Value="C:" /> 
+11
source

While you have defined the directory structure, the installer is only about to create the directories that are required by the components.

A simple option is to add a component of the following form:

 <Component Id="CreateLogFolders" Directory="PTLogFile"> <CreateFolder Directory="PTLogFile" /> <CreateFolder Directory="Backups" /> <CreateFolder Directory="CommandLog" /> <CreateFolder Directory="EventLog" /> <CreateFolder Directory="Responds" /> </Component> 

and reference this component in one of your functions.

+4
source

You prefer to place each <CreateFolder> element, which results in writing to the CreateFolder table in your own component. Otherwise, I'm not sure if this complies with the rules ...

Leave the directory structure as follows:

 <Directory Id="TARGETDIR" Name="SourceDir"> <Directory Id="PTLogFile" Name="PTLogFile" /> <Directory Id="ProgramFilesFolder"> <Directory Id="INSTALLFOLDER" Name="AServiceSetup"> </Directory> </Directory> 

And create the component as follows:

 <DirectoryRef Id="PTLogFile"> <Directory Id="Backups"> <Component Id="..." Guid="..."> <CreateFolder /> </Component> </Directory> <Directory Id="CommandLog"> <Component Id="..." Guid="..."> <CreateFolder /> </Component> </Directory> <Directory Id="EventLog"> <Component Id="..." Guid="..."> <CreateFolder /> </Component> </Directory> <Directory Id="Responds"> <Component Id="..." Guid="..."> <CreateFolder /> </Component> </Directory> </DirectoryRef> 
+1
source

All Articles