How to set NuGetEnvironment environment variable?
Issue: Unable to trigger a job from orchestrator after upgrading to 21.10.x as NuGetEnvironment is taking null FolderPath.
Error Message:
RemoteException wrapping System.ArgumentNullException: Value cannot be null. (Parameter 'path1')
at System.IO.Path.Combine(String path1, String path2)
at NuGet.Common.NuGetEnvironment.GetFolderPath(NuGetFolderPath folder)
at NuGet.Configuration.Settings.LoadUserSpecificSettings(String root, String configFileName, Boolean useTestingGlobalPath, SettingsLoadingContext settingsLoadingContext)+MoveNext()
at System.Collections.Generic.List`1.InsertRange(Int32 index, IEnumerable`1 collection)
How to Troubleshoot The Issue:
- Check the stack trace of the error. If it is throwing error while fetching and creating the nuget folder path "at NuGet.Common.NuGetEnvironment.GetFolderPath" then try below steps.
- Check the environment variable using the psexec tool: https://learn.microsoft.com/en-us/sysinternals/downloads/psexec
- Start command line as administrator and run PsExec64.exe /s cmd
- Above command will open the cmd under local system account. Now run command echo %APPDATA%
- the expected result should be: C:\WINDOWS\system32\config\systemprofile\AppData\Roaming
Expected Result:
But for this issue, %APPDATA% value will be empty or return same echo keyword. i.e. %APPDATA%.
Resolution:
- As long as the the %APPDATA% is set to that value, it should be fine. If echo %APPDATA% returns "C:\WINDOWS\system32\config\systemprofile\AppData\Roaming", it would mean that the variable is already set and has the correct value. There is no need to set it anymore.
- If empty value is obtained, set it using the below commands:
- PsExec64.exe -i -s cmd.exe
- setx APPDATA "C:\WINDOWS\system32\config\systemprofile\AppData\Roaming"
- Use the setx command in Windows to set the value of the APPDATA environment variable to a specific path.
- In case above does not help, generate the diagnostic tool log from "UiPath Assistant --> preferences --> tools --> start diagnostic tool" and open a ticket with UiPath technical support team.