When I check for dotnet version it is throwing an error
D:\jenkins\workspace\csharp-windows-test>dotnet --version
17:58:06 System.ArgumentNullException: Value cannot be null.
17:58:06 Parameter name: path1
17:58:06 at System.IO.Path.Combine(String path1, String path2)
17:58:06 at Microsoft.DotNet.Configurer.CliFolderPathCalculator.get_DotnetUserProfileFolderPath()
17:58:06 at Microsoft.DotNet.Configurer.FirstTimeUseNoticeSentinel..ctor(CliFolderPathCalculator cliFolderPathCalculator)
17:58:06 at Microsoft.DotNet.Cli.Program.ProcessArgs(String[] args, ITelemetry telemetryClient)
17:58:06 at Microsoft.DotNet.Cli.Program.Main(String[] args)
17:58:06
but when I search for 'where' it shows the location
17:58:06 D:\jenkins\workspace\csharp-windows-test>where dotnet
17:58:07 C:\Program Files\dotnet\dotnet.exe
This is causing build failures. Can someone suggest a best way to resolve this
Also I was able to execute the script on the machine directly without issues. This is only happening when called from Jenkins
D:\jenkins\workspace\csharp-windows-test>"C:\Program Files\dotnet\dotnet.exe" --version System.ArgumentNullException: Value cannot be null. Parameter name: path1 at System.IO.Path.Combine(String path1, String path2)