Reputation:
I am creating a Wix installer. I want to install my program and another file into the default programs folder, This is working fine.
I also want to put a file in folder "C:\Checkmark\Data", if this folder doesn't exist I want WiX to create it. This folder is not being created, and nothing is happening with the file.
My WiX file:
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate EmbedCab="yes"/>
<Feature Id="ProductFeature" Title="Checkmark" Level="1">
<ComponentGroupRef Id="ProductComponents" />
<ComponentGroupRef Id="ProductData"/>
</Feature>
<!--<UIRef Id="WixUI_Minimal"/>-->
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="Checkmark" />
</Directory>
<Directory Id="CommonAppDataFolder">
<Directory Id="CHECKMARKFOLDER" Name="Checkmark">
<Directory Id="DATAFOLDER" Name="Data" />
</Directory>
</Directory>
</Directory>
</Fragment>
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<Component Id="cmp_Checkmark.exe" Guid="B67B6527-C685-417F-A749-C8B908DF6AEF">
<File Id="fil_Checkmark.exe" KeyPath="yes" Source="C:\WPF test Projects\Checkmark\Checkmark\bin\Release\Checkmark.exe"/>
</Component>
<!--Overwrites file no matter what-->
<Component Id="cmp_TestDoc.txt" Guid="D2147C11-E2A4-4B78-8195-63788F88B012">
<File Id="fil_TestDoc.txt" KeyPath="yes" Source="C:\WPF test Projects\Checkmark\Checkmark\TestDoc.txt"/>
</Component>
</ComponentGroup>
<ComponentGroup Id="ProductData" Directory="DATAFOLDER">
<!--Does not overwrite File if it exists-->
<Component Id="cmp_KeepDoc.txt" NeverOverwrite="yes" Guid="02B29D8B-813C-4782-A6EC-EB614B218D84">
<File Id="fil_KeepDoc.txt" KeyPath="yes" Source="C:\WPF test Projects\Checkmark\Checkmark\KeepDoc.txt"/>
</Component>
</ComponentGroup>
</Fragment>
Can someone tell me why this folder isn't being created and my file not going in it?
Upvotes: 0
Views: 1510
Reputation: 587
If you want to put data in C:\CheckMark\Data
You could use following directory structure:
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="Checkmark" />
</Directory>
<Directory Id="CHECKMARKFOLDER" Name="Checkmark">
<Directory Id="DATAFOLDER" Name="Data" />
</Directory>
</Directory>
But TARGETDIR resolves to drive with maximum freespace. So If you seriously want to deploy in C Drive, you should update value of TARGETDIR to "C:\" explicitly.
Also CommonAppDataFolder resolves to another directory depending on host os. On Windows Vista/7 it resolves to C:\ProgramData.
You should check this link for more info.
https://msdn.microsoft.com/en-us/library/aa367992(v=vs.85).aspx
Upvotes: 1