Updating NuGet lock files will fail when running on Windows #25583
Answered
by
viceice
reduckted
asked this question in
Request Help
Replies: 1 comment 2 replies
-
@rarkins I think those variables are safe to pass to child process |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
How are you running Renovate?
Self-hosted Renovate
If you're self-hosting Renovate, tell us what version of Renovate you run.
37.45.0
If you're self-hosting Renovate, select which platform you are using.
github.com
Was this something which used to work for you, and then stopped?
I am trying to get this working for the first time
Describe the problem
When running Renovate on Windows, updating NuGet lock files fails with the error:
When the
ConfigurationDefaults
class in the error message is initialized, it finds a number of different directories. Some of those directories are found by using environment variables.This problem occurs because Renovate only passes a limited set of environment variables to package managers. When running on Windows, NuGet looks for a "machine-wide" settings directory which it looks for in the "Program Files" directory. It finds the path of that directory using the
PROGRAMFILES
environment variable. Since Renovate doesn't pass that environment variable through, the value ends up being null, which causes the error mentioned above.The environment variables that NuGet can use are found here (though only a subset seem to be needed when updating lock files):
https://github.com/NuGet/NuGet.Client/blob/7bff2239195640e51193a8640a153a570e4cabba/src/NuGet.Core/NuGet.Common/PathUtil/NuGetEnvironment.cs#L159-L229
I've been able to work around this problem by using
customEnvVariables
. There are a few environment variables that NuGet needs. I was able to get it working by specifying the current value for these environment variables:PROGRAMFILES
PROGRAMFILES(X86)
APPDATA
LOCALAPPDATA
It would be great if Renovate automatically passed those environment variables through when running
dotnet restore
to update the lock files.Minimal reproduction repository:
https://github.com/reduckted/repro-renovate-nuget-windows-bug/
Relevant debug logs
Logs
Have you created a minimal reproduction repository?
I have linked to a minimal reproduction in the description above
Beta Was this translation helpful? Give feedback.
All reactions