Define the folder like this:
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="CommonAppDataFolder">
<Directory Id="TestFolder" Name="test">
<Directory Id="ExampleFolder" Name="example" />
</Directory>
</Directory>
</Directory>
The important part here is the CommonAppDataFolder
Id, which is known by Windows installer. You can find the full list of known system folders in the Windows Installer Property Reference.
If you install any files to that folder, it will be created implicitly. If not, you can force it to be created by installing a component like this:
<Component Id="CreateTestFolder" Directory="ExampleFolder" Guid="PUT-RANDOM-GUID-HERE">
<CreateFolder />
</Component>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…