I have a tool that I created to help me package sample applications for the web. It removes stuff that I don’t want in the zip file like binaries, test results and various other junk that builds up when developing apps. It also removes source control bindings from the solution and project files.
Recently some testers for my latest hands on lab reported that when they double click on a .sln file that nothing happened. The file could be opened by Visual Studio with no problems. After examining the broken solution files and comparing to solution files that worked I found the source of the problem was the UTF8 Byte Order Mark (BOM) at the beginning of the file.
The solution was pretty simple, when I saved the file I just needed to add the UTF8 encoding to make everything work right.
File.WriteAllText(solutionFile, solutionText.Replace(tfs, null), Encoding.UTF8);
I’m writing this for some poor soul who in the future is searching the web wondering why the .sln file is not opening.
There is a Connect Bug logged on this but it is a slightly different problem
I have adapted to this longstanding problem by simply using File->Open from within Visual Studio. The "version selector" has *never* worked properly; at least now I know why.
Can you share the "clean up" tool. This is something I always wished was in VS.