1

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

2
  • What if you call the full path "C:\Program Files\dotnet\dotnet.exe" --version or "C:\Program Files\dotnet\dotnet.exe" --help? Do you get the same error?
    – Preston Martin
    Commented Aug 8, 2018 at 15:12
  • Im getting same error 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)
    – dingcoder
    Commented Aug 8, 2018 at 18:45

1 Answer 1

0

When I did echo %USERPROFILE% from Jenkins it returned null. So I had to manually set USERPROFILE value from Jenkins as environment variable. Also I had to set these

APPDATA=%USERPROFILE%\AppData\Roaming

LOCALAPPDATA=%USERPROFILE%\AppData\Local

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.