private void OverwriteProjectItemTextContent(ProjectItem item, string text) { var path = item.GetFullPath(); SolutionManager.EnsureCheckedOutIfExists(path); _fileSystem.WriteAllText(path, text); }
protected override void ProcessRecordCore() { if (string.IsNullOrEmpty(Path)) { throw new InvalidOperationException("Specify a value for 'Path'"); } // Resolve project-relative paths, as long as we know what project to look inside if (!System.IO.Path.IsPathRooted(Path)) { var project = SolutionManager.GetProject(string.IsNullOrEmpty(Project) ? SolutionManager.DefaultProjectName : Project); if (project == null) { WriteError(string.Format("Could not find project '{0}'", Project ?? string.Empty)); return; } var projectDir = System.IO.Path.GetDirectoryName(project.GetFullPath()); Path = System.IO.Path.Combine(projectDir, Path); } SolutionManager.EnsureCheckedOutIfExists(Path); }