Create user plugins for RPA Desktop Design Studio
Create user plugins by using Microsoft Visual Studio to enable RPA developers to use complex .NET components or libraries in RPA Desktop Design Studio in a seamless way.
Before you begin
Use either Microsoft Visual Studio Pro, Community, or Enterprise version to perform this task.
Role required: none
About this task
The following procedure describes how to create a user plugin using C#.NET.
Procedure
- Open Microsoft Visual Studio and click Create a new project.
-
In the Create a new project dialog box, select the Class Library (.NET
Framework) template.
Figure 1. Select a project type of Class Library DOT NET Framework - Click Next.
-
In the Configure your new project dialog box, fill in the following
fields:
Field Description and action Project name Name of your project. For example, MyFirstPlugin.
Location Location of your project. Select a disk location.
Solution name Name of your project's solution. Framework Select a framework version. Select .NET Framework 4.7 version.
-
Click Create.
The Class1.cs file opens.
- In the Solution Explorer pane, right-click References and select Add Reference.
- In the Reference Manager dialog box, navigate to Assemblies > Framework.
-
Select the System.AddIn assembly to add an annotation of
this addin.
Figure 2. Select System.AddIn assembly - Click OK.
-
In the Class1.cs file, add the
System.AddIn.AddIn("MyFirstPlugin", Description = "Learning to create custom components", Version = "1.0")code snippet above the class. -
In the Class1.cs file, create one or more public static methods to your
code.
In this example, two methods are added to the code:
- SayHello method: The name is taken as the input and returns "Hello" with a name and followed by an exclamation mark. For example, if the input is User, it returns "Hello User!".
- Sum method: Two numbers are taken as the input and returns the sum of these two numbers. For example, if the inputs are 5 and 12, it returns "17".
Figure 3. Public static methods - Click Save.
- In the Solution Explorer pane, right-click your project and select Build.
-
After the build is successful, do the following actions to copy and paste the
.dll files:
- In the Solution Explorer pane, right-click your project and select Open Folder in File Explorer.
- Navigate to bin > Debug and copy the .dll files.
-
Go to your RPA Desktop Design Studio automation project folder
and create a new folder as UserPlugins.
Important:Ensure that the spelling of this folder is entered correctly.
-
In the UserPlugins folder, create a folder and enter a name for the
folder.
For example, My First Plugin.
- Paste the .dll files in this folder.
-
In the RPA Desktop Design Studio, do the following actions to add the
plugin to your automation project:
- In the Project Explorer pane, right-click User Plugins and select Add User Plugin.
- In the Available User Plugins dialog box, select the plugin.
- Click OK.
In the Toolbox pane, the user plugin you created appears. -
Do the following actions to use the user plugin:
-
In the Toolbox pane, navigate to the user plugin component category to
select a method.
Figure 4. Two methods that appear in the user plugin component category - Drag a method to the Design surface.
- To provide the input parameter value manually, double-click the input parameter field under the method, and enter the value.
- To provide the input parameter value from another method or component, connect the Data In port of the method to the Data Out port of another method or component.
- Connect the control ports of the method to the corresponding ports of another method or component.
-
On the Design surface, right-click the title bar of the component from
where you want to start the execution and select Run From
Here.
Figure 5. Output of the SayHello method Figure 6. Output of the Sum method
-
In the Toolbox pane, navigate to the user plugin component category to
select a method.