# Stop Visual Studio from complaining about inconsistent line endings when working with Unity .cs files

DevFeed: [Stop Visual Studio from complaining about inconsistent line endings when working with Unity .cs files](<https://devfeed.tech/articles/stop-visual-studio-from-complaining-about-inconsistent-line-endings-when-working-with-unity-cs-files-41568.md>)

Original publisher: [Read original article](<http://www.adamtuliper.com/2015/10/stop-visual-studio-from-complaining.html>)

Author: Adam Tuliper (noreply@blogger.com)

Published: 2015-10-19T05:51:00Z

Content type: tutorial

Language: en

Sources: [Adam Tuliper](<https://devfeed.tech/sources/adam-tuliper.md>)

Topics: [Unity](<https://devfeed.tech/topics/unity.md>), [Visual Studio](<https://devfeed.tech/topics/visual-studio.md>), [Visual Studio Code](<https://devfeed.tech/topics/visual-studio-code.md>), [C#](<https://devfeed.tech/topics/csharp.md>), [Code](<https://devfeed.tech/topics/code.md>)

Tags: [c-sharp](<https://devfeed.tech/tags/c-sharp.md>), [cross-platform](<https://devfeed.tech/tags/cross-platform.md>), [unity](<https://devfeed.tech/tags/unity.md>), [visual-studio](<https://devfeed.tech/tags/visual-studio.md>), [visual-studio-code](<https://devfeed.tech/tags/visual-studio-code.md>)

## AI overview

A tutorial explains why inconsistent CR/LF and LF line endings appear in Unity C# files edited with Visual Studio, and how Visual Studio and Visual Studio Code handle line-ending normalization and selection.

## Source excerpt

If you are like me, you probably don't like the constant popup dialogs from Visual Studio and MonoDevelop on the inconsistent line endings. You may not have any idea what I'm talking about but constantly see this in Visual Studio while working with your Unity .cs files First - what on earth are inconsistent line endings? Let's look at what happens when you press ENTER on a PC based system vs a Unix based OS like OSX. A PC writes a CR/LF (carriage return / line feed) pair. A LF is '\n' or if you like hex 0x0A or 10 in decimal. A CR is '\r', 0x0D, 13 respectively. For you c/c++/c# programmers out there you've probably seen some string "Hello World\n" or "Hello World\r\n" - also noting we have a LF and CR/LF Let's take the following text.... See cat run See sharp Specifically if you look in a Hex Editor, the bytes in the file look like this on PC (note the highlight 0D 0A) and like this on a Mac (note the missing 0D) Why does this happen with Unity and Visual Studio? When Unity creates a C# file, it creates it by default with LF only as shown here. Visual Studio will open this up without a problem and without notifying you of anything. You aren't mixing CR/LF with your LF. Now you go ahead and paste some code into here, or use some existing code snippets, or format the document, or rely on some auto-complete/formatting features and they may stick in CR/LF into this doc (as you are editing on a pc). Now you have a file with LF and CR/LF mixed in it. It's inconsistent, hence you get a dialog box like the first image shown above Visual Studio loads that file. Also note that if you do tell Visual Studio to normalize the line endings (ie clicking yes in that first dialog) it will fix this issue, but for this file only. We have another product called Visual Studio Code (the free cross platform code editor/debugger) which actually just has a little drop down to select line endings and doesn't prompt you either as its a cross platform code editor. Visual Studio (a very differe