2017-08-14 123 views
0

我的解決方案有幾個常見項目。這意味着我也從其他解決方案中使用它們,並將這些常見項目組合到一個通用解決方案中。Visual Studio(2017) - 通用項目Git

例如:

* Common.sln具有CommonProject.csproj

* MySolution1.sln具有ProjectA.csproj,ProjectB.csproj,CommonProject.csproj

* MySolution2.sln具有projectX創建。 csproj,ProjectY.csproj,CommonProject.csproj

我使用源代碼控制器的git。 (Bitbucket回購)

我的問題是Git沒有跟蹤我的solution1和solution2上的常見項目。

感謝幫助

回答

0

這是因爲CommonProject.csproj不在本地資源庫的路徑存在solution1solution2

而且看來你在solution1solution2中增加了CommonProject.csproj通過Add - > Existing project。但通過這種方式,CommonProject.csproj仍位於Common.sln之下。

所以你應該複製CommonProject.csproj下的目錄solution1solution2,然後用新路徑添加項目。或者您應該添加回購,其中包括Common.sln作爲solution1solution2的git子模塊。

+0

我認爲這是我的問題更好的解決方案。謝謝你的幫助「或者你應該添加包括Common.sln作爲解決方案1和解決方案2的git子模塊的回購」我應該在git側還是在visual studio側進行此設置? –

+0

設置在git端。 'solution1'和'solution2'將'Common.sln'視爲庫或第三方代碼。有關git子模塊的更多細節,可以參考https://git-scm.com/book/en/v2/Git-Tools-Submodules。 –