Normalizing line endings in Visual Studio 2010

余生长醉 提交于 2019-12-05 00:02:00

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.

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.

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.

Peter Y

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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!