最近几天在写一些demo程序过程中,发现了一个让我头疼的事情。在VS2010下建了几个解决方案(i.e. Solution),写好程序后,将代码提交到Git仓库中,结果从另一台电脑上clone出来后,发现所有的solution文件全变成了 “Unrecognized Version”, 直接双击打不开解决方案了,只能通过右键选择Open with Visual Studio 2010或在Visual Studio中打开。Visual Studio Version Selector已经全然认不出这个解决方案了。
几经周折,原因可能是在push到git仓库的时候solution文件时,丢失了UTF8 byte order mark。
So far, the problem I’ve seen with all the broken files is the lack of a UTF8 byte order mark at the beginning of the file.
这个时候无论怎么修改那个.sln文件也不能找回version信息。其实要找回version信息,我们只要用Visual Studio先打开这个解决方案,然后做一些可以让Solution发生变化的事情,比如修改一些配置,然后全部保存,version信息就神奇的回来了。
参考:http://scientificninja.com/blog/fixing-unrecognized-version-sln-files