半途加入同事在VSS上已建好的專案,由於開發作業環境不同,我選擇不直接引用現成.sln檔,而是從VSS上取得各網站專案檔案,一一掛成IIS Web Application,再從VS2010中一一加入現有網站專案組成Souction,再使用選單(File/Source Control/Change Source Control...)設定與VSS的繫結(Binding)。

不過,在設定好所有VSS Binding後,發現其中某個Web Application命名有誤,於是我先將這個網站專案從Solution移除,在IIS上也移除重新用另一個名字掛上(例如: 原本是http:// localhost /OrigAppName,改成http:// localhost /NewAppName,但Bind的VSS來源是同一個),重新加入新網站專案,要Bind回原來的VSS來源,卻出現以下訊息:

Some projects have been bound to server locations that may be incorrect.

A location may be incorrect either because it does not contain the majority of the projects' files or because those files are not in the correct location relative to the specified server folder.

You should probably fix all the bindings in the solution. However, you may continue and bind these projects to the specified locations even when some may be incorrect.

反覆移除、重加網站專案都無法解決,最後祭出殺手鐧,將Solution的.suo檔移除重開Solution,總算排除問題。

順便簡介一下少有人注意的.suo檔,它本身是一個二進位格式的檔案,用來儲存跟個別開發者有關的設定。舉例來說: BLAH.sln裡有個網站專案,在開發者A的機器上掛在http:// localhost /BLAH1,而在開發者B的機器上則可能是http:// localhost /BLAH2。要是將此網站專案URL寫死在BLAH.sln裡,則寫成BLAH1或BLAH2都會導致另一個開發者無法正確開啟BLAH.sln。因此,像這類資料就被保存在.suo檔案裡,每個開發者自己保有自己的一份,不用跟別人共享,也不要Check In VSS。除此之外,在.suo中還有如中斷點等IDE相關設定,刪除檔案將會導致設定遺失,但如果你懷疑.suo的設定導致Visual Studio無法開啟.sln,把.suo砍掉重練也不失為解決辦法!


Comments

Be the first to post a comment

Post a comment