На основе официального руководства я написал свой код:
Код: Выделить всё
using NationalInstruments.VeriStand.ClientAPI;
class Program
{
static void Main(string[] args)
{
string gatewayIp = "localhost";
try
{
// Initialize Factory class instance to access NI VeriStand system
Factory factory = new Factory();
Console.WriteLine("Factory created successfully");
IWorkspace2 workspace = factory.GetIWorkspace2(gatewayIp);
Console.WriteLine("Workspace obtained successfully");
}
catch (Exception ex)
{
Console.WriteLine($"Error type: {ex.GetType()}");
Console.WriteLine($"Error message: {ex.Message}");
Console.WriteLine($"Error stack trace: {ex.StackTrace}");
}
}
}
Код: Выделить всё
Factory created successfully
Error type: System.Reflection.TargetInvocationException
Error message: Exception has been thrown by the target of an invocation.
Error stack trace: at System.RuntimeType.CreateInstanceOfT()
at System.Activator.CreateInstance[T]()
at NationalInstruments.VeriStand.ClientAPI.ClientServerManager`1.GetClientServer(String address)
at NationalInstruments.VeriStand.ClientAPI.ClientServerManagerInstances.GetDataServices(String address)
at NationalInstruments.VeriStand.ClientAPI.WorkspaceImpl..ctor(String address)
at NationalInstruments.VeriStand.ClientAPI.WorkspaceAggregator.Create(String address)
at NationalInstruments.VeriStand.ClientAPI.Factory.GetIWorkspace2(String gateway_ip_address)
at Program.Main(String[] args) in C:\Users\Hongb\Documents\Git\ConsoleApp1\ConsoleApp1\Program.cs:line 18

Будем благодарны за любое руководство, спасибо!
Подробнее здесь: https://stackoverflow.com/questions/791 ... -an-invoca