Generating Target Files via API

Hi

I have a program which iterates each target file in my project, checks to see it's translatable, then performs these task on each file:

1. Generate Target Files

Guid[] fileId = { targetFiles[i].Id };
AutomaticTask translateTask = project.RunAutomaticTask(
fileId,
AutomaticTaskTemplateIds.GenerateTargetTranslations);

If this task has a status of "Completed" it performs the 2nd task.

2.Export Target Files

AutomaticTask export = project.RunAutomaticTask(
targetFiles.GetIds(),
AutomaticTaskTemplateIds.ExportFiles);

However, each GenerateTargetTranslations task ends with status = "Failed" with the error message: "The file exists"

I've read before that "AppData\Local\Temp" can be a problem so before the program starts I always delete the contents of this folder.

Can someone tell me what "The file exists" message really means as it's quite cryptic?

Best Regards

Mark