13

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?

4 Answers 4

22

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.

Sign up to request clarification or add additional context in comments.

1 Comment

This just pretends the problem doesn't exist. I'd prefer to actually fix it: actually have a VS setting that insures mac/nix style line endings from, say, pasted code, always get normalised in the first place, before the file is saved and put into source control.
3

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.

1 Comment

While this is an interesting workaround to normalize line-endings, it is not necessary to go through Notepad++ (or any other “proper text-editor”): Visual Studio can do the EOL normalization itself during load/save, and in fact this is exactly what it prompts the user for (unless disabled as suggested by the accepted answer), and it doesn't solve the problem that on the next edit by the “one particular person” the file have to be normalized again. Probably a better solution would be to ask the “one particular person” to do the normalization themselves when saving ;-)
2

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.

Comments

1

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

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.