I think the solution is to exclude the configuration file from the MSI package and use custom action to copy file (or create default if one does not exists). And, of course, the action can makes any checks of the file if it's nessesary.
But you have to add code to manage the configuration file during uninstallation process and so on. it's another custom action.
Something like that:
[CustomAction]
public static ActionResult CopyBootstraperConfig(Session session)
{
try
{
const string configFile = "Chiffa.exe.config";
var customConfig = Path.Combine(Path.GetDirectoryName(session["OriginalDatabase"]), configFile);
var targetConfig = Path.Combine(session.GetTargetPath("INSTALLLOCATION"), configFile);
if (File.Exists(customConfig))
File.Copy(customConfig, targetConfig);
try
{
//do file checks
}
catch (Exception e)
{
File.Delete(targetConfig);
throw;
}
}
catch (Exception e)
{
return ActionResult.Failure;
}
return ActionResult.Success;
}