Go to Project> Solution Options> Source Code> Code Formatting> Text File In the Line Terminations drop box select Unix/Mac. Show activity on this post. The LF is clickable and you choose either LF or CRLF. Pretty sure that visual studio code, not visual studio.
The Quick FixAt the bottom right of the screen in VS Code there is a little button that says “LF” or “CRLF”: Click that button and change it to your preference. Voila, the file you are editing now has the correct line breaks.
VS Code => Settings => Files: EoLAnd choose “\n” as EoL character if you would like your files to have Unix Style line endings and choose “\r\n” if you would like your files to have Windows Style line endings. VS Code — Eol Settings for Files. That settings applies to all new files that you create.
So happy for you, Microsoft, \r\n Windows Notepad users, rejoice! Microsoft's text editing app, which has been shipping with Windows since version 1.0 in 1985, has finally been taught how to handle line endings in text files created on Linux, Unix, Mac OS, and macOS devices.
There'a an add-in for Visual Studio 2008 that converts the end of line format when a file is saved. You can download it here: http://grebulon.com/software/stripem.php
You don't have to install any plugins.
As mentioned here you can configure line endings in File -> Advanced Save options...
Yes, there is a way to always have LF line endings, at least in Visual Studio 2010 Pro.
Go to Tools | Options... | Environment | Documents
Then Enable the Check for consistent line endings on load option.
It works for me.
Visual Studio 2008 doesn't retain the advanced save options after the solution is closed. I would be willing to hand edit a lot of files if that would make it work consistently, but I am not willing to change all of the settings every time I open VS.
This is too bad. Since VS does support forcing the line-endings to whatever is desired in the backend, its just not hooked up properly in the UI. Maybe Microsoft will fix this isn a service pack.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With