Reputation: 1872
I have a solution with some class libraries that are used in multiple other projects. When I do an Install-Package
from VS it will take $(SolutionDir)\packages\
and translate that into a relative path, for example ..\packages\
. This is then saved into the .csproj
files.
My problem is that these .csproj files are used in different locations with different file hierarchies, meaning that ..\packages\
will not point to $(SolutionDir)\packages\
in some other solutions. So the question is, how do I get it to write $(SolutionDir)\packages\
into the .csproj
files instead of ..\packages\
?
Upvotes: 3
Views: 2999
Reputation: 1104
One thing that can be used is that you keep all your solutions at one level. That way packages folder would be at same level for all solutions/projects.
Upvotes: -1
Reputation: 47987
You cannot get NuGet to write $(SolutionDir)\packages into the project files. You would need to modify its source code.
What NuGet provides is a way for multiple solutions to share a common packages directory by defining this directory in a NuGet.Config file.
<configuration>
<config>
<add key="repositoryPath" value="SomeDirectory\Packages" />
</config>
</configuration>
You can put this NuGet.config file in a directory that is a common parent to the solutions and then NuGet will find it and use it for the solutions.
Upvotes: 4