Taking code backups and doing a rollback is not an inbuilt feature in InnoSetup. However, with some customization, this can be easily achieved.
To backup code, a line very similar to code installation can be created when the installer is first created. For example:
Source: {app}\\*; DestDir: "{#InstallHomeDir}\UnInstall\{#MyAppVersion}\Websites\ "; Components: Core; Flags: {#UninstallFlags}; Check:TakeBackup;
This line is similar to a code install line, except it copies code from the application folders on the target machine to a pre-determined backup location. So this line only fires at run-time when code is being installed. For each "Source" line in the installer for code installation, there will be a matching line for backup similar to the one above. Note that a version number is included inside the DesDir to handle multiple patch scenarios. A Check is also used to turn backups on or off.
Once the backup is done, at un-install time, you can fire the following command from within Inno Setup:
Exec('xcopy', ExpandConstant('"{#InstallHomeDir}\UnInstall\{#MyAppVersion}\Websites" "{app}" /f /c /v /e /r /h /y'), '',SW_SHOW, ewWaitUntilTerminated, ResultCode)This will copy ALL your folders you have backed up to the {app} folder.