private static FileInfo CreateNewTemporaryFile(FileInfo masterFile)
{
var temporaryFile = new FileInfo(GetTempFileName());
// Copy the file to enable other processes to update it.
try
{
File.Copy(masterFile.FullName, temporaryFile.FullName);
EventLog.Info("Created temp data file - \"{0}\"", temporaryFile.FullName);
}
catch (IOException ex)
{
throw new MobileException(String.Format(
"Could not create temporary file. Check worker process has " +
"write permissions to '{0}'. For medium trust environments " +
"ensure data file is located in App_Data.",
temporaryFile.FullName), ex);
}
return temporaryFile;
}