What does Visual Studio mean by normalize inconsistent line endings?

Solution 1:

What that usually means is that you have lines ending with something other than a carriage return/line feed pair. It often happens when you copy and paste from a web page into the code editor.

Normalizing the line endings is just making sure that all of the line ending characters are consistent. It prevents one line from ending in \r\n and another ending with \r or \n; the first is the Windows line end pair, while the others are typically used for Mac or Linux files.

Since you're developing in Visual Studio, you'll obviously want to choose "Windows" from the drop down. :-)

Solution 2:

Some lines end with \n.

Some other lines end with \r\n.

Visual Studio suggests you to make all lines end the same.

Solution 3:

If you are using Visual Studio 2012:

Go to menu FileAdvanced Save Options → select Line endings type as Windows (CR LF).

Solution 4:

To turn the option ON/OFF, follow the steps below from menu bar:

ToolsOptionsEnvironmentDocumentsCheck for consistent line endings on load

Solution 5:

The file you are editing has been edited with some other editor that does not use the same line endings, resulting in a file with mixed line endings.

The ASCII characters in use for line endings are:

CR, Carriage Return
LF, Line Feed

Windows = CRLF
Mac OS 9 or earlier = CR
Unix = LF