Jenkins 中的错误路径环境变量

Wrong Path environment variable in Jenkins

当我检查 Jenkins 的 SystemInfo 时,我发现那里的 Path 变量与我检查 Windows Path 变量时不同。这是一个比较:左侧来自 Jenkins SystemInfo,右侧 - 来自 Windows.

Visual Studio 2017 msbuild 被 nuget.exe 选择,无法恢复 .net core 3.1 项目。我以为 Jenkins 是从系统继承 Path 的,无法理解附加值从何而来。

好的,我找到了Jenkins环境变量的来源。由于 Jenkins 作为 windows 服务运行,它从 services.exe 继承变量,而 services.exe 继承自 wininit.exe。因此,如果您更改了环境变量(就像我所做的那样)并想强制 Jenkins 更新其变量,那么重新启动 Jenkins 服务是不够的,您必须重新启动 Windows 或 explorer.exe