Add git submodule as reference to existing solution in VS

Lets say I have submodule repo:

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

And two projects which needs DbModel as reference library:

  • Why does git think HEAD is the first commit from 17 years ago?
  • What are the conceptual differences between Merging, Stashing and Rebasing in Git?
  • Install git via homebrew on mac osx 10.10 results in: Error: Permission denied - /usr/local/lib/perl5/site_perl/5.18.2
  • git revert: Is it possible to identify potentially conflicting commits before actual revert?
  • How to force Composer to use https:// instead of git://?
  • Can you order git log by commit timestamp?
  • _git/TTT
    _git/TPM
    

    I’ve already add DbModel as submodule via GitBash to both of them

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

    And my local repos now look like this:

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

    My Team Explorer shows two different solutions which are available now and I can switch between them easily.

    But. Maybe this is kinda newbie question…

    I don’t know how to add DbModel solution as reference to TPM and TTT!
    When I click “Add Reference” -> “Browse” in VS I can only add “.dll, .tlb, .olb, .ocx, .exe, .manifest” as “reference files.

    How its supposed to work? Should I compile sub module solution every time and add .dll as reference? I need source code to be added.

  • Does picking a range of commits with cherry-pick or rebase --onto end up with the same result?
  • Migrate repos between instances of Gitlab
  • Piping output from Git Bash to clipboard
  • In Git, how do I configure a hook to run a server-side commands after a commit is accepted?
  • Git master branch simply does not have new files after merge
  • Selectively merging *parts* of a file with git?
  • One Solution collect form web for “Add git submodule as reference to existing solution in VS”

    For those who will be interested in this:

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

    and then add existing project in your solution from newly created folder. Like that:

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

    P.S.

    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 Baby is a git and github fan, let's start git clone.