VideoOS.Platform.SDK.Environment.dll library integration on AVEVA System Platform.

I have imported the DLL library correctly and I can use the scripting to program the login, but it throws this error for the first try/catch:

Error: System.TypeInitializationException: The type initializer for 'VideoOS.Platform.SDK.Environment' threw an exception. ---> System.IO.FileNotFoundException: Could not load file or assembly 'Autofac, Version=4.9.4.0, Culture=neutral, PublicKeyToken=17863af14b0044da' or one of its dependencies. The system cannot find the file specified.
   at VideoOS.Platform.SDK.Environment.RecreateContainer()
   at VideoOS.Platform.SDK.Environment..cctor()
   --- End of inner exception stack trace ---
   at VideoOS.Platform.SDK.Environment.AddServer(Boolean secureOnly, Uri uri, NetworkCredential networkCredential, Boolean masterOnly)
   at ArchestrA.Scripting.Script.Execute(ScriptTimer )

And I have got this error on the second try/catch:

 Error: System.TypeInitializationException: The type initializer for 'VideoOS.Platform.SDK.Environment' threw an exception. ---> System.IO.FileNotFoundException: Could not load file or assembly 'Autofac, Version=4.9.4.0, Culture=neutral, PublicKeyToken=17863af14b0044da' or one of its dependencies. The system cannot find the file specified.
   at VideoOS.Platform.SDK.Environment.RecreateContainer()
   at VideoOS.Platform.SDK.Environment..cctor()
   --- End of inner exception stack trace ---
   at VideoOS.Platform.SDK.Environment.AddServer(Boolean secureOnly, Uri uri, NetworkCredential networkCredential, Boolean masterOnly)
   at ArchestrA.Scripting.Script.Execute(ScriptTimer )

However, my code in scripting is this:

dim uri as System.Uri;
dim secureOnly as boolean;
dim nc as System.Net.NetworkCredential;
 
try 
	VideoOS.Platform.SDK.Environment.Initialize();
	VideoOS.Platform.SDK.Log.Environment.Initialize();
catch
	LogMessage("Error: "+error);	
endtry;
 
LogMessage("***Se inicia Test Login***");
 
' Definicion del servidor
uri = new System.Uri("http://192.168.3.131");
 
' Securización del servidor
secureOnly = true;
' If true, only authentication over https is accepted. If false, authentication over both http and https is accepted.
 
' Generar credenciales de usuario;
nc = new System.Net.NetworkCredential("alex", "Sistemas2111");
 
LogMessage("*(Paso0) ===> Carga de datos realizada.");
 
' Se genera el servidor con las credenciales proporcionadas
try 
	VideoOS.Platform.SDK.Environment.AddServer(secureOnly, uri, nc);
catch
	LogMessage("Error: "+error);	
endtry;
 
LogMessage("*(Paso1) ===> Servidor con credenciales cargado.");
 
VideoOS.Platform.SDK.Environment.Login(uri);
 
LogMessage("*(Paso2) ===> Login OK.");
 
' Si no hay errores es que esta OK
' Cargar la configuración de los item puede llevar tiempo.
' Realizar la carga del login
VideoOS.Platform.SDK.Environment.LoadConfiguration(uri);
LogMessage("*(Paso3) ===> Load Configuration OK.");
 
' Se inicializa la variable del lanzador
Me.LanzarTestLogin = false;

Do I have to import other libraries?

Is any other inzialization required?

Thanks,

Alex

Hi,

Did you include the library as a Nuget package, or just import the single .dll file?

Using only the .dll file will not work properly, you need to include the entire Nuget package, which should also ensure that transient dependencies (like, in this instance, Autofac) are handled properly.

Best regards,

Simon Rønneberg