It first reads the full project file into memory and looks for a single CRLF to determine the line endings. This could be changed to use a reader and only read until the first newline. Alternatively, the logic could be changed to count and compare number of carriage returns and newlines (for example checking if CR > LF / 2) to better handle mixed line endings.
Then it reads the whole file into memory again at the end to replace the line breaks, if they differ from the line endings used by Microsoft.Build. I don't think this can be done in a streaming fashion without using a temporary file, but that may be preferable.
I haven't been able to find a way to override the behavior of Microsoft.Build.Evaluation.Project.Save.
Fixes #98.
@RicoSuter: I don't know if this is too invasive?
It first reads the full project file into memory and looks for a single
CRLF
to determine the line endings. This could be changed to use a reader and only read until the first newline. Alternatively, the logic could be changed to count and compare number of carriage returns and newlines (for example checking ifCR > LF / 2
) to better handle mixed line endings.Then it reads the whole file into memory again at the end to replace the line breaks, if they differ from the line endings used by Microsoft.Build. I don't think this can be done in a streaming fashion without using a temporary file, but that may be preferable.
I haven't been able to find a way to override the behavior of
Microsoft.Build.Evaluation.Project.Save
.