Msbuild: WriteLinesToFile should create the directory if it doesn't exist

Created on 28 Dec 2018  路  4Comments  路  Source: dotnet/msbuild

The WriteLinesToFile task doesn't create the directory for the file if it doesn't exist.

It should call Directory.CreateDirectory(Path.GetDirectoryName(File)) to help with the pit of success. Too much ceremony with requiring authors to create the directory themselves.

Tasks Feature Request

Most helpful comment

I would like to implement this.

All 4 comments

I would like to implement this.

@CodeTherapist this should be a good start, and where the task lives: https://github.com/Microsoft/msbuild/blob/master/src/Tasks/FileIO/WriteLinesToFile.cs#L15

All yours, @CodeTherapist. Let us know if you need any help.

@rainersigwald, @Therzok: Thank you for your helpfulnes :)

Was this page helpful?
0 / 5 - 0 ratings