locked
Inconsistent line endings in VS 2017 RRS feed

  • Question

  • User-1793215261 posted

    I am getting the following dialogue box in VS 2017:

    'The line endings in the following file are not consistent. Do you want to normalize the line endings?' It then gives the name of the file: Default.aspx.

    There is then a drop down box with:

    Windows (CR LF)
    Macintosh (CR)
    Unix (LF)
    Unicode Line Separator
    Unicode Paragraph Separator

    Which line endings and what is meant by 'not consistent'? Not consistent with what?

    Thank you.

    Wednesday, December 12, 2018 4:35 PM

Answers

  • User-893317190 posted

    Hi Bluenose,

    Because the code line ends with \r\n, some lines's line breaks are \r or \n, \r\n is the default line break for the Windows operating system, and the latter two are linux and mac, so VS detected a problem and issued a warning. But because windows can also recognize \r or \n newline characters, it is also possible to ignore them directly
    If you are modifying the code to be used on linux on VS, you should choose which line ending to use.
    If you want vs not to give a warning, you could select Tools->Options->Environment->Documents ,then uncheck Check consistent for line endings on load.

    Best regards,

    Ackerly Xu

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, December 13, 2018 3:22 AM

All replies

  • User-893317190 posted

    Hi Bluenose,

    Because the code line ends with \r\n, some lines's line breaks are \r or \n, \r\n is the default line break for the Windows operating system, and the latter two are linux and mac, so VS detected a problem and issued a warning. But because windows can also recognize \r or \n newline characters, it is also possible to ignore them directly
    If you are modifying the code to be used on linux on VS, you should choose which line ending to use.
    If you want vs not to give a warning, you could select Tools->Options->Environment->Documents ,then uncheck Check consistent for line endings on load.

    Best regards,

    Ackerly Xu

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, December 13, 2018 3:22 AM
  • User-1793215261 posted

    Thank you - I have selected Tools->Options->Environment->Documents ,then unchecked Check consistent for line endings on load.

    Thursday, December 13, 2018 8:41 PM