Question

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?

Was it helpful?

Solution

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.

OTHER TIPS

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>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top