What does Visual Studio mean by normalize inconsistent line endings?

后端 未结 11 2033
没有蜡笔的小新
没有蜡笔的小新 2020-11-30 19:51

Visual Studio occasionally tells me:

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

11条回答
  •  情歌与酒
    2020-11-30 20:07

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

提交回复
热议问题