0

I'm checking for ways to add a reference to a project in another solution.

To be specific, I can add the reference to a project, even if it is in another solution. But I met 2 issues:

  1. It refer the project by relative path, which may or may not exist if my colleagues update the project
  2. The Nuget package is not there (it is in the other solution's package folder)

For example, Let's say Project Restaurant (Solution A) depends on Project HotDog (Solution B). On project HotDog we refers a library Quartz for example. But when we build, it would throw an exception "cannot find Quartz" because the reference of HotDog is pointing to "../packages", not "[Path_to_solutionB]\packages"

Of course we can re-add the reference but this solution is temporary only and will not work on our CI server (will retrieve these configurations through SVN).

I think there must be a way. So is there any best practice to cross-reference project in different solutions, without impacting the solution-managed Nuget Lib Packages?

Hoàng Long
  • 10,746
  • 20
  • 75
  • 124
  • Why not add Quartz to Restaurant? If that's not possible, add HotDog build output (DLL and all) instead of the project so that it does not need building. – Adrian Godong Apr 06 '16 at 01:58
  • Well, even if I add Quartz to Restaurant, aka add it to Solution A, then the path of Quartz would be [Path To Solution A]\Packages\Quartz. However the reference in HotDog.csproj would still be ..\Packages\Quartz. – Hoàng Long Apr 06 '16 at 02:06
  • Got it, so you're facing a build error. How about adding the build output to Solution A and reference it instead of rebuilding HotDog? – Adrian Godong Apr 06 '16 at 02:10
  • @AdrianGodong: I'm testing your suggestion – Hoàng Long Apr 06 '16 at 02:32
  • 1
    One thing we did to solve this type of problem is to have all our solutions at the root level of TFS so that there was only one packages folder and we used the same references across all solutions. Generally we have a master solution as well where all projects in the entire product are included. This is useful for many reasons including this type of scenario. Currently we have 300-400+ projects in this solution. – Cole W Apr 12 '16 at 01:04
  • @Cole W: After consideration, your way seems to be the only feasible way for now. I guess we need lots of time for a major re-organization though... – Hoàng Long May 09 '16 at 02:36

0 Answers0