What does Visual Studio mean by normalize inconsistent line endings?

后端 未结 11 1938
没有蜡笔的小新
没有蜡笔的小新 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 19:54

    There'a an add-in for Visual Studio 2008 that converts the end of line format when a file is saved. You can download it here: http://grebulon.com/software/stripem.php

    0 讨论(0)
  • 2020-11-30 19:59

    If you are using Visual Studio 2012:

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

    0 讨论(0)
  • 2020-11-30 19:59

    When you copy paste something from web, you might get the inconsistent line endings.
    In order to fix this, you can use Visual studio extension "Line Endings Unifier" which can make line ending consistent automatically while saving file.

    0 讨论(0)
  • 2020-11-30 20:01

    The Wikipedia newline article might help you out. Here is an excerpt:

    The different newline conventions often cause text files that have been transferred between systems of different types to be displayed incorrectly. For example, files originating on Unix or Apple Macintosh systems may appear as a single long line on some programs running on Microsoft Windows. Conversely, when viewing a file originating from a Windows computer on a Unix system, the extra CR may be displayed as ^M or at the end of each line or as a second line break.

    0 讨论(0)
  • 2020-11-30 20:04

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

    ToolsOptionsEnvironmentDocumentsCheck for consistent line endings on load

    0 讨论(0)
  • 2020-11-30 20:05

    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

    0 讨论(0)
提交回复
热议问题