2

I have been struggling with what (at least in my mind) should be simple:

I have two projects, the "MainProgram" and a "SubLibrary". Both were created with a Git Repository using the new Visual Studio 2012 Git support.

Both repositories work fine independently.

However when I "Add Existing Project"/SubLibrary to my MainProgram Solution, SubLibrary is not being "git-monitored" by Visual Studio at all - no overlaid status icons in Solution Explorer etc. - its just as if that project was not under source-control.

Through some research, I added a git submodule to the MainProgram repo, added the cloned version of SubLibrary project to the solution and .. the git-icons in Solution Explorer appeared!! ... but my joy was short-lived ..... No History, the status of changed files did not show in Solution Explorer. The changes were however picked up by TortoiseGit from within File Explorer.

The .gitmodules file looked OK (but as you can gather I am NO git guru!) .....

Surely it must be possible to have version control over multiple projects/repos within a single solution!

I would be very greatful if anyone could point me in the right direction!

4

1 回答 1

0

在 Git 中,确实通常拥有较小的存储库。一个典型的存储库将包含一个项目,而 TFS 和 Subversion 往往在一个存储库中有多个项目。

这将导致您描述的情况。目前据我所知,Visual Studio(和 TFS)中没有 git 多存储库支持。当每个项目都驻留在自己的 Git 存储库中时,根本不可能有一个包含多个项目的单一解决方案。

我过去做过的事情:

  • 我创建了一个目录作为根目录
  • 在该目录中为每个单独的项目创建一个子目录
  • 在其各自的子目录中克隆每个 git 存储库
  • 在项目中使用带有相对路径的文件引用来添加引用
  • (可选)创建一个 MSBuild 文件,以正确的顺序构建所有解决方案。通过这种方式,您可以使用多个 Git 存储库创建构建。

通过这种方式,您不会有一个单一的解决方案,但您将能够在每个单独的存储库中跟踪您的更改。

希望这对您有所帮助。

于 2013-04-24T09:00:29.597 回答