Once and For All: Mac Visual Studio - fix inconsistent line endings?
I've been through every discussion that I can find in this forum and on the Web, and yet no solution that works to fix this inconsistent line endings issue on Mac Visual Studio Community 2019.
No, on Mac VS there is no Savebutton dropdown where you can choose the encoding.
There are no line-ending-fixer addons/plugin tools that are compatible with Mac VS.
Choosing Save As with UTF-8 or any of the other formats does not seem to fix it.
None of the preferences encoding options seem to fix it.
Nor those in the project settings option (which just mirror the prefs)
I am looking for a solution for existing files.
Maybe there is some combination I am missing? Does anyone have a solution for Mac VS that is working for you?
Answer by deventorum · Sep 01, 2020 at 04:23 PM
This is very ridiculous issue indeed, I've spent way more time fixing it than I should have. Solution that worked for me (LF encoding):
1) In Visual Studio, go to Preferences -> Text Editor -> General and set Line ending conversion to Always Convert Line Endings
2) Then back to Preferences -> Source Code -> Code Formatting -> C# source code (or some other file types if you work with them) and change Line ending property to Unix/Mac. These two should prevent Visual Studio to generate Windows line endings in your files.
3) About fixing the existing files, I couldn't find any good way to do it in VS, but you can use other text editor/IDE to change line encoding. I've just formatted and saved all files with inconsistent line endings using VS Code.
I hope this helps!
This helps a lot thanks! Ridiculous issue and puts me off doing anything on the mac with Unity
Answer by lugduweb · May 29, 2020 at 05:20 AM
Can't find a way to fix it in Visual Studio Mac 8.6 (Unity 2019.3.14).
Answer by jnzhuang · Jul 26, 2021 at 02:39 AM
I use:
dos2unix file.cs
and the warning message is gone.
Your answer
![](https://koobas.hobune.stream/wayback/20220612224144im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
"Error installing application" when updating Visual Studio on a Mac 7 Answers
Visual Studio for Mac External Drive Sharing Violation 1 Answer
#if UNITY_IOS - disables everything in Visual Studio 1 Answer
Can't code on Mac: "The reference assemblies for .NETFramework,Version=v4.7.1 were not found " 1 Answer