gpt4 book ai didi

git - 添加 git 子模块作为对 VS 中现有解决方案的引用

转载 作者:太空狗 更新时间:2023-10-29 12:51:18 29 4
gpt4 key购买 nike

假设我有一个子模块仓库:

_git/DbModel (only source code indexed. No /bin or /obj folders)

以及两个需要DbModel作为引用库的项目:

_git/TTT
_git/TPM

我已经通过 GitBash 将 DbModel 添加为子模块

 git submodule add https://RepoPath/_git/DbModel

我的本​​地仓库现在看起来像这样:

Source\Repos\TTT\TTT.sln
Source\Repos\TTT\DbModel\DbModel.sln

Source\Repos\TPM\TPM.sln
Source\Repos\TPM\DbModel\DbModel.sln

我的团队资源管理器显示了两种不同的解决方案,现在可以使用,我可以轻松地在它们之间切换。

但是。也许这是一个有点新手的问题......

我不知道如何添加 DbModel 解决方案作为对 TPM 和 TTT 的引用!当我在 VS 中单击“添加引用”->“浏览”时,我只能添加“.dll、.tlb、.olb、.ocx、.exe、.manifest”作为“引用文件”。

它应该如何运作?我是否应该每次都编译子模块解决方案并添加 .dll 作为引用?我需要添加源代码。

最佳答案

对于那些对此感兴趣的人:

git submodule add https://RepoPath/_git/DbModel
git submodule init //this is IMPORTANT
git submodule update

然后从新创建的文件夹中将现有项目添加到您的解决方案中。像那样:

 Source\Repos\TPM\DbModel\DbModel\DbModel.csproj

附言

Source\Repos\TPM\                  solution root folder (with main project sln file inside it)
Source\Repos\TPM\DbModel submodule root folder (with submodule sln file)
Source\Repos\TPM\DbModel\DbModel submodule project folder (with csproj file)

关于git - 添加 git 子模块作为对 VS 中现有解决方案的引用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28273980/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com