public override bool Execute() { try { // Read content of the template file string content = File.ReadAllText(TemplateFile); // Replace tokens in the template file content with version info if (tokenReplacer.SourceControlInfoProvider != null) { tokenReplacer.SourceControlInfoProvider.IgnoreToolNotFound = IgnoreToolNotFound; tokenReplacer.SourceControlInfoProvider.Path = ToolPath; } content = tokenReplacer.Replace(content); // Write the destination file, only if it needs to be updated if (!File.Exists(DestinationFile) || File.ReadAllText(DestinationFile) != content) { File.WriteAllText(DestinationFile, content); } return(true); } catch (BuildErrorException e) { Log.LogError(e.Message); return(false); } }
public override bool Execute() { try { // Read content of the template file string content = File.ReadAllText(TemplateFile); // Replace tokens in the template file content with version info content = tokenReplacer.Replace(content); // Write the destination file, only if it needs to be updated if (!File.Exists(DestinationFile) || File.ReadAllText(DestinationFile) != content) { File.WriteAllText(DestinationFile, content); } return(true); } catch (BuildErrorException e) { Log.LogError(e.Message); return(false); } }