I have to install an application with several folders. If my Targetdir is not a default path, say [ProgramFilesFolder]\[Manufacturer]\[ProductName]
, all the folders can be installed in that Targetdir. Otherwise, some folders, say "Bin" and "AddIns", should be installed in a different path, say [CommonAppDataFolder]\[Manufacturer]\[ProductName]
.
I would like to avoid a C# or C++ custom action. Instead, I would try to use something like a Type51 CA. Is it possible?
I wrote the following code:
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="CommonAppDataFolder">
<Directory Id="dir_B1AA3D43_E9A6_4283_81B7_D24FDA02FEC4" Name="List SpA">
<Component Id="comp_dir_B1AA3D43_E9A6_4283_81B7_D24FDA02FEC4" Guid="AB641867-3F7A-4A74-9923-03E71FC6851C" KeyPath="yes" Transitive="yes">
<Condition><![CDATA[TARGETDIR = "[ProgramFilesFolder][Manufacturer]\[ProductName]"]]></Condition>
</Component>
<Directory Id="dir_9D19AF5A_89F2_498D_AC25_B48F2C16BFF5" Name="TestApplication">
<Directory Id="dir_BinID2" Name="Bin">
<Component Id="comp_dir_BinID2" Guid="2E369F78-D321-4828-A2A8-E958E57B910B" KeyPath="yes">
<Condition><![CDATA[TARGETDIR = "[ProgramFilesFolder][Manufacturer]\[ProductName]"]]></Condition>
</Component>
<Component Id="comp_38B4C656_8291_4C45_98D5_A46908E33723" Guid="61DB01E5-6D6B-48AE-862A-3E2C18D546E7" Permanent="no" SharedDllRefCount="no" Transitive="no">
<File Id="_14E547A6_A0C5_441E_A294_59AD578B99DF" DiskId="1" Hidden="no" ReadOnly="no" TrueType="no" System="no" Vital="yes" Name="TestApplication.exe" Source="..\Debug\TestApplication.exe" KeyPath="yes" />
</Component>
</Directory>
<Directory Id="dir_AddInsID2" Name="AddIns">
<Component Id="comp_dir_AddInsID2" Guid="0CA9B394-77E5-48A9-85A8-F6FF0737C499" KeyPath="yes" Transitive="yes">
<Condition><![CDATA[TARGETDIR = "[ProgramFilesFolder][Manufacturer]\[ProductName]"]]></Condition>
</Component>
<Component Id="comp_6DCECE0A_AE42_49F1_BA42_B23EF2A50E44" Guid="216B87DA-4F28-4DC9-85AA-E3801E2C0A8B" Permanent="no" SharedDllRefCount="no" Transitive="no">
<File Id="_D271147D_4984_4C55_9660_33F4617957F5" DiskId="1" Hidden="no" ReadOnly="no" TrueType="no" System="no" Vital="yes" Name="ClosePromptCA.CA.dll" Source="..\ClosePromptCA\bin\Debug\ClosePromptCA.CA.dll" KeyPath="yes" />
</Component>
<Component Id="comp_98FCDB58_9307_44D7_9CFE_3F1DB41BD779" Guid="B8368238-B1B6-4D78-BC21-0D26B84E4938" Permanent="no" SharedDllRefCount="no" Transitive="no">
<File Id="_75368244_3285_47FD_BBC8_60CEC98755B4" DiskId="1" Hidden="no" ReadOnly="no" TrueType="no" System="no" Vital="yes" Name="Microsoft.Deployment.WindowsInstaller.dll" Source="..\ClosePromptCA\bin\Debug\Microsoft.Deployment.WindowsInstaller.dll" KeyPath="yes" />
</Component>
</Directory>
</Directory>
</Directory>
</Directory>
<Directory Id="dir_AddInsID" Name="AddIns">
<Component Id="comp_dir_AddInsID" Guid="0219CA84-4787-4737-99E7-95ACD8E0846D" KeyPath="yes" Transitive="yes">
<Condition><![CDATA[TARGETDIR <> "[ProgramFilesFolder][Manufacturer]\[ProductName]"]]></Condition>
</Component>
<Component Id="comp_23612F37_B27B_49E2_9FB6_9D2FA3654FB1" Guid="290915D5-38E9-4540-B7B7-7BBC27D96CA0" Permanent="no" SharedDllRefCount="no" Transitive="no">
<File Id="_0193CC70_4486_4226_BE10_4F9C927DD5F2" DiskId="1" Hidden="no" ReadOnly="no" TrueType="no" System="no" Vital="yes" Name="ClosePromptCA.CA.dll" Source="..\ClosePromptCA\bin\Debug\ClosePromptCA.CA.dll" KeyPath="yes" />
</Component>
<Component Id="comp_41AA7508_C12C_46CC_A383_7088A8500898" Guid="5CACA050-A59C-44DF-BF5A-8694D547D937" Permanent="no" SharedDllRefCount="no" Transitive="no">
<File Id="_362C000D_A631_4E5D_9288_FB623CD999E3" DiskId="1" Hidden="no" ReadOnly="no" TrueType="no" System="no" Vital="yes" Name="ClosePromptCA.XML" Source="..\ClosePromptCA\bin\Debug\ClosePromptCA.XML" KeyPath="yes" />
</Component>
</Directory>
<Directory Id="dir_BinID" Name="Bin">
<Component Id="comp_dir_BinID" Guid="99ADE113-162C-4299-8A3E-EDCE1FB838DE" KeyPath="yes" Transitive="yes">
<Condition><![CDATA[TARGETDIR <> "[ProgramFilesFolder][Manufacturer]\[ProductName]"]]></Condition>
</Component>
<Component Id="comp_FD9AB046_9110_4BFD_865F_D919F02D7B2B" Guid="5690A672-809F-47D1-938E-EAC0E18A0685" Permanent="no" SharedDllRefCount="no" Transitive="no">
<File Id="_89CFA2F5_2ED8_43C8_890E_A791BF9E16BB" DiskId="1" Hidden="no" ReadOnly="no" TrueType="no" System="no" Vital="yes" Name="TestApplication.exe" Source="..\Debug\TestApplication.exe" KeyPath="yes" />
</Component>
</Directory>
<Directory Id="dir_DocsID" Name="Docs">
<Component Id="comp_ECF1F68E_B9B8_49DD_9631_88E0722F8FCC" Guid="CB3861D1-6101-4F3C-94DD-AEE3EE74C217" Permanent="no" SharedDllRefCount="no" Transitive="no">
<File Id="_9CE2FA29_27F8_4C00_B22D_A99AA59E5B2D" DiskId="1" Hidden="no" ReadOnly="no" TrueType="no" System="no" Vital="yes" Name="ReadMe.txt" Source="..\TestApplication\ReadMe.txt" KeyPath="yes" />
</Component>
</Directory>
<Directory Id="dir_LogsID" Name="Logs">
<Component Id="comp_B81BDCFD_B947_49C0_A07F_C1546D02E7AF" Guid="CE5206CE-E651-42C6-88AF-B7D83A9318C2" Permanent="no" SharedDllRefCount="no" Transitive="no">
<File Id="_FF44C1E7_C235_47B9_BA01_C797D13EBA7D" DiskId="1" Hidden="no" ReadOnly="no" TrueType="no" System="no" Vital="yes" Name="trace.log" Source="bin\Debug\trace.log" KeyPath="yes" />
</Component>
</Directory>
<Directory Id="dir_TemplateID" Name="Template">
<Component Id="comp_8F946A00_3D1E_44C5_A288_E0662FFE253D" Guid="8C0A501B-15D4-46B1-91C3-23E5035CB145" Permanent="no" SharedDllRefCount="no" Transitive="no">
<File Id="_39F2BD37_C7FE_4CF1_98C7_1E7BFC1B4873" DiskId="1" Hidden="no" ReadOnly="no" TrueType="no" System="no" Vital="yes" Name="ReadMe.txt" Source="..\..\CrashReportManager\ReadMe.txt" KeyPath="yes" />
</Component>
</Directory>
</Directory>
Everything looks like right, but Wix ignore the Conditions. Wix installs my components even if the conditions are false! What is the reason?