How do I force unix (LF) line endings in Visual Studio (Express) 2008?

Solution 1:

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

Solution 2:

You don't have to install any plugins. As mentioned here you can configure line endings in File -> Advanced Save options...

Solution 3:

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.

Solution 4:

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.