c# – 我如何處理Git中的Visual Studio檔案?
我通常使用.NET使用Git進行版本控制.在我的團隊中,我們並行工作,我們經常提交我們的程式碼來整合應用程式.一切都很好,但Visual Studio的解決方案和專案檔案.我們發現兩種方法:
>永遠不要提交這些檔案,每個人都有自己的
>將這些檔案包含在版本系統中
這兩種方式都有優缺點,但是基本上我們每次從中央回購中抽出來都是鬥爭的.這裡有一些我們發現的備用問題:(在上面列出的引文中)
>我們必須在專案(1)中包含其他人的檔案,或者包括我們最新的(2)
>如果我們使用不同的架構(x86 / x64),我們必須手動更改.csproj檔案(2)
>相同的問題回答了參考和NuGet包
等等.我可以使用適當的工作流程嗎?
提交.sln和.csproj檔案通常是最佳實踐(如ofollow,noindex" target="_blank">this answer ),但合併需要注意.
參見“ Why are my.csproj
files getting messed up after agit rebase
?
”.
* .csproj -text merge = union(見下文)
* .sln -text merge = unionv
或者您可以放棄.csproj並在本地重新生成as in this tweet .
忽略這些csproj檔案的另一個原因是,如果它們被重新生成,則為in this context
yellowblood 警告(in the comments )關於csproj檔案與merge = union策略一起使用時的嚴重衝突問題.
這回應了文章“
Merge conflicts incsproj
files
”.
這就是為什麼有一個suggestion for VS IDE should support file patterns in project files (為了不修改.csproj檔案,如果新增一個適合該模式的新的.cs檔案).
It’s been suggested that if Visual Studio sorted its elements first, that would help mitigate the problem.That helps reduce the incidental conflicts caused by Visual Studio’s apparent non-deterministic sort of elements.But it doesn’t make the issue of merge conflicts go away.
程式碼日誌版權宣告:
翻譯自:http://stackoverflow.com/questions/21511959/how-i-deal-with-visual-studio-files-in-git