问题
We have multiple developers working on an application and it seems that whenever one particular person works on a file then anyone else works on it they will get:
The line endings in the following file are not consistent. Do you want to normalize the line endings?
Is there some option in Visual Studio that we can have that developer change so we don't continually have this very irritating message pop up all the time?
回答1:
If you don't want Visual Studio to check this when it opens the file, you can uncheck the box when prompted ("Always show this dialog") or in Tools->Options under Environment->Documents-> "Check for consistent line endings on load"
Someone on your project is probably using an editor that uses Unix-style or Mac-style line endings.
回答2:
It appears that Visual Studio preserve line endings when you copy/paste code from other sources. It means that even if you work alone on one platform you can get those annoying warnings.
We recently had mixed Mac and Windows line endings in a script after some code copy/paste from other project.
The issue was solved through copying the whole mixed code into a proper text-editor which was Notepad++. We then copied the text from Notepad++ and replaced text in Visual Studio. The resulting text had unified line endings.
回答3:
I've gotten this message before ( usually working with Unity3D and using VS2012 as my compiler ). The easiest way I've found to take care of the issue is to let VS format the code ( CTRL-K, CTRL-D ) and then save it.
回答4:
If you are using version control then make sure that the server and client configurations for line endings are consistent with the way people are working and the server should be able to handle it properly.
Eg for Perforce: http://kb.perforce.com/?article=063
Eg for Subversion, use svn:eol-style property http://svnbook.red-bean.com/en/1.7/svn.advanced.props.file-portability.html#svn.advanced.props.special.eol-style
来源:https://stackoverflow.com/questions/3406897/normalizing-line-endings-in-visual-studio-2010