Question
Can the folder %USERPROFILE%\.dotnet
and %USERPROFILE%\.nuget
be relocated to non-OS drive (in my case D: drive).
Constraints
- I use a VM which is provisioned by organization I work for; with limited space in OS drive.
- We are asked to save data to a different drive which has sufficient enough space and could be expanded.
- I cannot edit system environment variables. I can only add/edit environment variables at User scope / level.
Activities performed
I have futile attempts the following suggestions already -
Edit the
%APPDATA%\NuGet\NuGet.config
file and change the value for key -CliFallbackFolder
, andglobalPackagesFolder
.<?xml version="1.0" encoding="utf-8"?> <configuration> <packageSources> <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" /> <add key="globalPackagesFolder" value="D:\nuget\packages" /> <add key="CliFallbackFolder" value="D:\dotnet\NuGetFallbackFolder" /> </packageSources> </configuration>
a. The value for
CliFallbackFolder
gets reset to%USERPROFILE%\.dotnet
next time I run dotnet restoreI have defined
NUGET_PACKAGES
environment variable @ user scope and have set its value to non-OS drive. **affects only the .nuget folder location **I SO'ed this question and have already seen (with problem still persisting) -
a. https://github.com/dotnet/cli/issues/4003 (Question on the .dotnet folder is not responded)
b. Is it possible to change the location of packages for NuGet? (focuses on the .nuget folder and not on the .dotnet\CliNuGetFallbackFolderFallbackFolder)
Raised an issue in github. I realized that I have committed a mistake by raising an issue in preview 3 of the code branch. I also realized this is more a question than a issue, thus posting the question here. (https://github.com/dotnet/cli/issues/7256)
dotnet --info output
.NET Command Line Tools (2.0.0-preview2-006497)
Product Information: Version: 2.0.0-preview2-006497 Commit SHA-1 hash: 06a2093335
Runtime Environment: OS Name: Windows OS Version: 6.1.7601 OS Platform: Windows RID: win7-x64 Base Path: C:\Program Files\dotnet\sdk\2.0.0-preview2-006497\
Microsoft .NET Core Shared Framework Host Version : 2.0.0-preview2-25407-01 Build : 40c565230930ead58a50719c0ec799df77bddee9
dotnet nuget --version
NuGet Command Line 4.3.0.3
For the first part of the question -
Answer is
As of dotnet core 2.0.0-preview2-006497, it is not possible. The folder in question is part of SDK and is expected to be located in
%USERPROFILE%
directory.github response on the issue
I still feel for the constraints listed above, it is essential that at least in future versions it should be enabled.
The question which is still open is
Please do share suggestions and do mind the steps already taken as an attempt to achieve the goal in the first post.