We have a solution that contains a project that uses TestFramework from NuGet. We've another solution that references that project.
The project/solution file system structure looks like this:
- Tests
- Tests
- Properties
- AssemblyInfo.cs
- packages.config
- Tests.csproj
- Tests.sln
- RefToTests
- RefToTests.sln
RefToTests.sln
contains a reference to Tests.csproj
.
If I open the Tests.sln
and try to build it I get an error that tells me that the referenced NuGet dependencies could not be found. No problem - open the NuGet management for solution, click restore and build it again. Works fine.
The same clean folder but now open RefToTests.sln
. Same error. Same workflow. That restores the packages to RefToTest\packages
. The project is looking for them at ..\packages
what means Tests\packages
. That will not build.
We tried to fix that by manually change the folder to the packages in the project file from ..\packages
to $(SolutionDir)packages
. That worked great. The missing packages are downloaded automatically (wow that doesn't work without that change).
But now let's update the package. The package manager is not able to find that references in the project file, leaves the old entries untouched and added completely new references. The project won't build in any solution. That seams to be a bug in NuGet project management. In my opinion the package resolution should crash if it finds $(SolutionDir)
or the package management should be able to handle that.
But what is the solution? Changing the directory to $(SolutionDir)
and check every project file after every update? Leave the specified folder as it is and never do a cleanup on the repository?