How to fix inconsistent line endings for whole VS solution?

Just for a more complete answer, this worked best for me:

Replace

(?<!\r)\n

with

\r\n

in entire solution with “regEx” option.

This will set the correct line ending in all files which didn’t have the correct line ending so far. It uses the negative lookahead to check for the non-existance of a \r in front of the \n.

Be careful with the other solutions: They will either modify all lines in all files (ignoring the original line ending) or delete the last character of each line.

Leave a Comment

tech