Let's see how we can fix the problem explained here.
According to the latest release notes by now you should be able to change the packages folder by adding this setting in the Nuget.config file:
However unfortunately I couldn't make this work :( So I found a workaround.
I want to make the Second.sln use the package folder of First.sln. So I have made the following changes to the NuGet.targets file.
According to the latest release notes by now you should be able to change the packages folder by adding this setting in the Nuget.config file:
1 2 3 | < configuration > < config > < add key = "repositoryPath" value = "C:\myteam\teampackages" ></ add > |
1 2 3 | </ config > ... </ configuration > |
- I this section:
I have added the following row:12345
<
PropertyGroup
Condition
=
" '$(OS)' == 'Windows_NT'"
>
<!-- Windows specific commands -->
<
NuGetToolsPath
>$([System.IO.Path]::Combine($(SolutionDir), ".nuget"))</
NuGetToolsPath
>
<
PackagesConfig
>$([System.IO.Path]::Combine($(ProjectDir), "packages.config"))</
PackagesConfig
>
</
PropertyGroup
>
1<
PackagesDir
>$(SolutionDir)..\First\packages</
PackagesDir
>
-
Change the arguments of the NewGetCommand from:
to:1
<
RestoreCommand
>$(NuGetCommand) install "$(PackagesConfig)" -source "$(PackageSources)" $(RequireConsentSwitch) -solutionDir "$(SolutionDir)</
RestoreCommand
>
I have added -o "$(PackagesDir)" which should make the packages to be downloaded to the PackagesDir folder1<
RestoreCommand
>$(NuGetCommand) install "$(PackagesConfig)" -source "$(PackageSources)" -o "$(PackagesDir)" $(RequireConsentSwitch) -solutionDir "$(SolutionDir)</
RestoreCommand
>
- To make the configuration more flexible we can change the PackagesDir definition to
this will allow us to predefine the PackagesDir value in the .csproj.user files.1
<
PackagesDir
Condition
=
"'$(PackagesDir)' == ''"
>$(SolutionDir)..\First\packages</
PackagesDir
>
- To test this we can add the C:\ NugetConfig\First\Dummy\Dummy.csproj.user with the following content:
This will make the Nuget to get files in the C:\NugetConfig\packages folder.123456
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<
PropertyGroup
>
<
PackagesDir
>C:\NugetConfig\packages</
PackagesDir
>
</
PropertyGroup
>
</
Project
>
Is it possible that it didn't work because of the extra space before repositoryPath:
ReplyDelete<add key=" repositoryPath"
Where is the NuGet.targets file you're editing? I thought it was a per-machine config file, so other people working on the same project would also have to edit their NuGet.targets file?
Nope, I've tried it with and without the space (as in the release notes there is space) and I couldn't make it work.
ReplyDeleteAbout the NuGet.targets file, it is located in ".nuget" subfolder in the solution folder.
What i do not realize is in truth how you are not really much more well-liked than you may be now. You are so intelligent. You realize therefore significantly on the subject of this topic, produced me in my opinion believe it from numerous numerous angles. Check telephone answering service for best Telephone Service.
ReplyDeleteSo many years later, setting the repository path seem to work just fine.
ReplyDelete