Writing Agent Plugins in Visual Studio
Whilst it is recommended that agent plugins are created in the dynamic code editor, it is also possible to create them using Microsoft Visual Studio.
- Open Visual Studio and create a new Class Library (.NET Framework) project, ensuring that the .NET Framework 4.8 is targeted.
- Open the installation directory on a machine where the XIA Configuration Client is installed, which is by default
C:\Program Files\CENTREL Solutions\XIA Configuration\XIA Configuration Service - Copy the following files to your development machine and add a reference to them in your project.
CENTREL.XIA.Configuration.Agents.DynamicAgentPluginBase.dll
CENTREL.XIA.Configuration.Agents.BaseAgent.dll
CENTREL.XIA.Configuration.Client.Model.dll
CENTREL.XIA.Configuration.Types.dll
CENTREL.XIA.Support.dll - Create a new class file, and within the class file create a new class which inherits from DynamicAgentPluginBase.
- Override the Execute() method, and enter the custom code that is required. The item property and agent settings are accessible in the same way as within the dynamic code editor.
- Compile the .dll file and deploy only the single .dll file, for example "SamplePlugin.dll" to the XIA Configuration Client service installation directory, which is by default
C:\Program Files\CENTREL Solutions\XIA Configuration\XIA Configuration Service - The external .dll file must be executed from the dynamic code editor from an assigned plugin with the ExecuteExternalCustomPlugin command, passing the filename of the plugin as the parameter.
- The code contained within the external plugin will be executed as part of the scan.