What does Visual Studio mean by normalize inconsistent line endings?

CloudMeta picture CloudMeta · Feb 16, 2009 · Viewed 147.9k times · Source

Visual Studio occasionally tells me:

The line endings in the following files are not consistent. Do you want to normalize the line endings?

It then gives me a drop down with different standards or something, such as Windows, Mac, Unix, and a couple of Unicode ones.

What does this mean and what is going to happen if I click Yes?

Answer

Ken White picture Ken White · Feb 16, 2009

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. :-)