27

We have a lot of in-house libraries that we would like to share between projects inside the company. These are some of the requirements:

  • library sources are stored in repositories separated from end-projects
  • end-projects include libraries via NuGet
  • it must be possible to easily inspect the source code for any given libary while working on an end-project

Setting up our private NuGet repository isn't a problem, but managing sources is. We tried to expose the sources via source server and it kinda works, but not quite: VS downloads the sources while debugging external code, but not when you try to navigate to definition/implementation. Basically, you can only go to source code when debugging, which is not quite what we need.

So, the questions are:

  • what ways exist to provide access to source code of internal libraries without the need to having the code in the same repo/solution
  • is there a way to set up the Symbol server/NuGet feed combo so that VS uses the symbols for navigation, not just for debugging?

Using ReSharper/other add-ins is an option.

Dyppl
  • 431

3 Answers3

1

What should work is simply checking out the source code for the NuGet package and opening the solution in a separate instance of Visual Studio.

Visual Studio has a neat trick of switching between code in open instances by working out what you have referenced. The first time this happened to me whilst I was debugging, was a revelation.

The main problem you face is making sure the checked out code for the dependent package represents the same version as your NuGet reference in the main project. Not a problem if you follow a policy of always building against the most recent version of your package.

Another benefit of this approach is that if the package needs to change, you can make the change there and then.

-1

Maybe you can use https://github.com/GitTools/GitLink. It adds a link in the pdb file pointing to the repository so Visual Studio will fetching source code from there - and then you just need to include the pdb file in your nuspec package and won't need a source server.

-1

So it's not a perfect solution, but you mention that you could optionally use Resharper; with dotPeek and resharper you can navigate to the disassembly of the original code, it's what I use at work, where we have a similar setup to yours.

I find a combination of the Symbol Server you mentioned and browsing the disassembly is normally sufficient to figure out what's going on.

Hope that helps.

Edit: Having re-read your question I realise you specifically ask to be able to browse the source code, which this is not. Nonetheless hopefully it'll be useful to someone.