You can use a simple PowerShell code like:
$version = ([xml](Get-Content 'config.xml')).Configuration.Version
Set-Content -Path 'version.txt' -Value $version
And run it using Inno Setup preprocessor:
#define RetrieveVersion(str FileName) \
Local[0] = AddBackslash(GetEnv("TEMP")) + "version.txt", \
Local[1] = \
"-ExecutionPolicy Bypass -Command """ + \
"$version = ([xml](Get-Content '" + FileName + "')).Configuration.Version;" + \
"Set-Content -Path '" + Local[0] + "' -Value $version;" + \
"""", \
Exec("powershell.exe", Local[1], SourcePath, , SW_HIDE), \
Local[2] = FileOpen(Local[0]), \
Local[3] = FileRead(Local[2]), \
FileClose(Local[2]), \
DeleteFileNow(Local[0]), \
Local[3]
[Setup]
AppVersion={#RetrieveVersion("C:\path\config.xml")}
For a similar question, see Read application version from a text file in Inno Setup.
Though I assume that the application compiler actually uses the config.xml
for the application executable version. If that's the case, you can retrieve the version from the .exe more easily.
See How do I automatically set the version of my Inno Setup installer according to my application version?