public async Task WriteAllText(string path, string value) { System.IO.Directory.CreateDirectory(System.IO.Path.GetDirectoryName(path)); using (var stream = new FileStream(path, FileMode.Create, FileAccess.Write)) using (var writer = new StreamWriter(stream)) using (var reader = new StringReader(value)) { await reader.CopyToAsync(writer); } }