When running the published project from Orchestrator second time after logging off the Robot machine, exception "System.Exception: Could not find file 'C:\Users\USERNAME\.nuget\packages\PROJECT_NAME\PROJECT_VERSION\lib\net45\Main.xaml' is logged.
Issue Description: Below exception occurred when running the published project from Orchestrator second time after logging off the Robot machine: "System.Exception: Could not find file ‘C:\Users\USERNAME.nuget\packages\PROJECT_NAME\PROJECT_VERSION\lib\net45\Main.xaml’
Issue occurs for all the processes. However processes are running fine every time, when running it from Robot tray .
Root Cause: This error (System.Exception: Could not find file ‘C:\Users\USERNAME.nuget\packages\PROJECT_NAME \PROJECT_VERSION\lib\net45\Main.xaml’) generally comes when Robot is not able to find the main.xaml file in the project folder in the Robot machine. Non-persistent nature of VM as “.xaml” files get deleted from userprofile after logging off from the machine.
Resolution: Try the below approaches,
- Since the issue is happening after every second run, below is the more probable cause of the issue:
- Verify the persistent nature of the VM / VDI and follow below steps:
- Publish the new version of package and download it manually in the robot machine.
- Manually log off the machine.
- Log In back and the check files present in path " %Userprofile%.nuget/packages "
- If able to see the activities dependencies then open the path present in the above exception
- ie C:\Users\USERNAME\.nuget\packages\PROJECT_NAME \PROJECT_VERSION\lib\net45 and check if ".xaml" files are present or not.
- If files are present then check the project.json file present in the path mentioned in the exception and check "main" key. Verify if the correct name is present or not.