2

I have a few repositories in Mercurial with the following structure:

  • Core
  • Integration
  • Admin
  • MyApp

From the MyApp repo, I want to include Core and Integration.

I add those as a sub-repo to MyApp, and place it inside an Externals folder.

Folder structure for MyApp looks roughly as this:

MyApp
- BusinessLogic
- DataAccess
- Externals
-- Core
-- Integration
- Web
- packages

The problem has got to do with the packages folder. I use package restore in all solutions, and NuGet downloads all packages fine. The folder contains the packages that my external projects rely on.

Only problem is, that the relative path from Core and Integration to the packages folder is now wrong.

Is there any way I can solve this?

MartinHN
  • 19,542
  • 19
  • 89
  • 131

2 Answers2

2

I think you can fix it manually, your references should have relative hint path which starts with ../../packages. But to avoid this in future All you solutions which include this projects must have the same structure. For example for other solution you have structure like:

MyOtherApp
- BusinessLogic
- DataAccess
- Externals
-- SubFolder
--- Core
--- Integration
- Web
- packages

If in this case you add nuget package to Core project, reference will be ../../../packages/.... And Core will be broken in other solutions again.

Other solution is make package from Core and Integration projects and use them in other solutions via nuget. My team uses for this TeamCity, it can pack projects, publish nuget packages and work as nuget feed out the box.

Pavel Bakshy
  • 7,697
  • 3
  • 37
  • 22
  • That would work, but only when the `Core` and `Integration` projects are opened as an external. This will stop working if I open the solution directly. – MartinHN Aug 28 '12 at 14:02
  • 1
    Better solution which based on Nuget idea - make package from your `Core` and `Integration` projects and use it in other solutions as nuget packages – Pavel Bakshy Aug 28 '12 at 14:18
  • Yes, I've actually taken that route and are dumping externals/subrepos since they add more confusion. – MartinHN Aug 28 '12 at 14:39
  • Change your answer to something about Nu Get, and I'll mark it as the answer and you get the points. – MartinHN Aug 28 '12 at 17:28
  • I'm already using TeamCity, so a private Nu Get feed was a no-brainer :) – MartinHN Aug 28 '12 at 21:38
1

If you still want to keep it as a sub-repository (as opposed to referencing the projects as NuGet packages) you can modify the the hint paths to always search the solution directory.

For instance, I changed

<HintPath>..\..\packages\Moq.4.2.1312.1622\lib\net40\Moq.dll</HintPath>

to

<HintPath>$(SolutionDir)packages\Moq.4.2.1312.1622\lib\net40\Moq.dll</HintPath>
zastrowm
  • 8,017
  • 3
  • 43
  • 63