I have been creating a solution file (sln) from scratch as part of a custom MSBuild task. After hours of not understanding why it wasn’t working, I spent the time to format exactly like a sample solution. Still no luck. In the end, I found out that I was only putting a line feed \n, instead of \r\n.
It now works fine.