I'm having trouble running UiPath's .nupkg file using C# Visual Studio.
I used to run the command "\UiPath\Studio\UiRobot.exe" -file "xxx.nupkg" -input "{ 'txt_path': test.txt' }"
in CMD, and it was successful.
However, when i try it on c# on debug mode (See the similar code below.)
using System;
using System.Diagnostics;
class Program
{
static void Main()
{
// Define the command and arguments
string command = "\"UiPath\\Studio\\UiRobot.exe\"";
string fileArgument = "-file \"xxx.nupkg\"";
string inputArgument = "-input \"{{ 'txt_path': '\\\\test.txt' }}\"";
// Combine command and arguments
string fullCommand = $"{command} {fileArgument} {inputArgument}";
// Start the process
ProcessStartInfo startInfo = new ProcessStartInfo
{
FileName = "cmd.exe",
Arguments = $"/C {fullCommand}",
RedirectStandardOutput = true,
RedirectStandardError = true,
UseShellExecute = false,
CreateNoWindow = false
};
using (Process process = Process.Start(startInfo))
{
using (var reader = process.StandardOutput)
{
string result = reader.ReadToEnd();
Console.WriteLine("Output:");
Console.WriteLine(result);
}
process.WaitForExit();
Console.WriteLine($"Process exited with code: {process.ExitCode}");
}
}
}
Nothing appears on my computer, and there’s no popup window, unlike when I run the command in CMD.
UIpath is already install on my local computer.
-----------------Update-----------------
I am using IIS Express to host a server that triggers the UiPath .nupkg file.