14 writes to OutputFile
Microsoft.Build.Tasks.Core (3)
WriteCodeFragment.cs (3)
103OutputFile = null; 111OutputFile = new TaskItem(Path.Combine(OutputDirectory.ItemSpec, OutputFile.ItemSpec)); 114OutputFile ??= new TaskItem(FileUtilities.GetTemporaryFile(OutputDirectory.ItemSpec, null, extension));
Microsoft.Build.Tasks.UnitTests (11)
WriteCodeFragment_Tests.cs (11)
34task.OutputFile = new TaskItem("foo"); 50task.OutputFile = new TaskItem("foo"); 84task.OutputFile = new TaskItem("CombineFileDirectory.tmp"); 155task.OutputFile = new TaskItem(fileName); 179task.OutputFile = new TaskItem(file); 210task.OutputFile = new TaskItem(file); 237task.OutputFile = new TaskItem(file); 256task.OutputFile = new TaskItem("||//invalid||"); 297task.OutputFile = new TaskItem(file); 428task.OutputFile = new TaskItem(file); 1087OutputFile = outputFile,
48 references to OutputFile
Microsoft.Build.Tasks.Core (8)
WriteCodeFragment.cs (8)
87if (OutputFile == null && OutputDirectory == null) 109if (OutputFile != null && OutputDirectory != null && !Path.IsPathRooted(OutputFile.ItemSpec)) 111OutputFile = new TaskItem(Path.Combine(OutputDirectory.ItemSpec, OutputFile.ItemSpec)); 116FileUtilities.EnsureDirectoryExists(Path.GetDirectoryName(OutputFile.ItemSpec)); 118File.WriteAllText(OutputFile.ItemSpec, code); // Overwrites file if it already exists (and can be overwritten) 122string itemSpec = OutputFile?.ItemSpec ?? String.Empty; 128Log.LogMessageFromResources(MessageImportance.Low, "WriteCodeFragment.GeneratedFile", OutputFile.ItemSpec);
Microsoft.Build.Tasks.UnitTests (40)
WriteCodeFragment_Tests.cs (40)
91Assert.Equal(file, task.OutputFile.ItemSpec); 94File.Delete(task.OutputFile.ItemSpec); 116Assert.Equal(expectedFile, task.OutputFile.ItemSpec); 136Assert.Equal(file.ItemSpec, task.OutputFile.ItemSpec); 137Assert.True(File.Exists(task.OutputFile.ItemSpec)); 160Assert.Equal(fileName, task.OutputFile.ItemSpec); 185Assert.Equal(file, task.OutputFile.ItemSpec); 215Assert.Null(task.OutputFile); 242Assert.Null(task.OutputFile); 331string content = File.ReadAllText(task.OutputFile.ItemSpec); 357string content = File.ReadAllText(task.OutputFile.ItemSpec); 382Assert.True(File.Exists(task.OutputFile.ItemSpec)); 383Assert.Equal(Path.GetTempPath(), task.OutputFile.ItemSpec.Substring(0, Path.GetTempPath().Length)); 384Assert.Equal(".cs", task.OutputFile.ItemSpec.Substring(task.OutputFile.ItemSpec.Length - 3)); 386File.Delete(task.OutputFile.ItemSpec); 405Assert.True(File.Exists(task.OutputFile.ItemSpec)); 406Assert.Equal(folder.ItemSpec, task.OutputFile.ItemSpec.Substring(0, folder.ItemSpec.Length)); 407Assert.Equal(".cs", task.OutputFile.ItemSpec.Substring(task.OutputFile.ItemSpec.Length - 3)); 464File.Delete(task.OutputFile.ItemSpec); 510string content = File.ReadAllText(task.OutputFile.ItemSpec); 515File.Delete(task.OutputFile.ItemSpec); 534string content = File.ReadAllText(task.OutputFile.ItemSpec); 539File.Delete(task.OutputFile.ItemSpec); 566string content = File.ReadAllText(task.OutputFile.ItemSpec); 572File.Delete(task.OutputFile.ItemSpec); 602string content = File.ReadAllText(task.OutputFile.ItemSpec); 611File.Delete(task.OutputFile.ItemSpec); 705string content = File.ReadAllText(task.OutputFile.ItemSpec); 713File.Delete(task.OutputFile.ItemSpec); 738string content = File.ReadAllText(task.OutputFile.ItemSpec); 743File.Delete(task.OutputFile.ItemSpec); 1105string content = File.ReadAllText(task.OutputFile.ItemSpec); 1119if ((task.OutputFile is not null) && File.Exists(task.OutputFile.ItemSpec)) 1121File.Delete(task.OutputFile.ItemSpec); 1143if ((task.OutputFile is not null) && File.Exists(task.OutputFile.ItemSpec)) 1145File.Delete(task.OutputFile.ItemSpec);