private static AddTextFileToProject ( Project project, IFileSystem fileSystem, string projectRelativePath, string text ) : void | ||
project | Project | |
fileSystem | IFileSystem | |
projectRelativePath | string | |
text | string | |
return | void |
private static void AddTextFileToProject(Project project, IFileSystem fileSystem, string projectRelativePath, string text)
{
// Need to be sure the folder exists first
var outputDirPath = Path.GetDirectoryName(projectRelativePath);
var projectDir = project.GetOrCreateProjectItems(outputDirPath, true /* create */, fileSystem);
var diskPath = Path.Combine(project.GetFullPath(), projectRelativePath);
fileSystem.WriteAllText(diskPath, text);
projectDir.AddFromFile(diskPath);
}