I am a newbie to UIPath and I face a problem when I am trying to create a custom namespace and importing it. Below is the sequence of steps that are taken as part of this process:
1. Wrote a custom namespace in C# having getters and setters and method
and built it in release mode successfully
2. Using the Nugget Package Explorer, packaged the XYZ.dll file and obtained an XYZ.nupkg
3. Placed the XYZ.dll and XYZ.nupkg in the "C:\Program Files (x86)\UiPath\Studio" and
"C:\Program Files (x86)\UiPath\Studio\Packages" respectively.
4. The package appeared in the Package Manager and installed it and pulled the XYZ.dll file as
Imports under the "imports" tab.
The class has a method taking (key and value as parameters) that adds it to a dictionary created in the class. when the method is invoked passing values to the parameter, it is not added to the dictionary (checked by printing it on the console), However, if I Uninstall the package and do the same process the outcome turns out to be the expected one. Couldn’t understand this strange behavior!!!
Here are the steps how to add the DLL to the UiPath packages… @kandaguru_baskaran Ofcourse you have done it already,…
Select c# Class Library
Add references system.activities and system.componentModel;
Write the required code to be executed
Define the input and output parameters
build the solution
Go to the containing folder and open bin folder
open the Nuget explorer and create new library and add the dll selecting the add existing option
Click to edit and change the name of the package
Save the package file with the desired name and copy the file(.nupckg extension) to the path C:\Users\hamadasi\AppData\Local\UiPath\app-18.4.0\Packages
Open UIPath and search for the name and click install you will be able to execute the code giving the inputs
The sample code which I have written is :
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Activities;
using System.ComponentModel;
namespace CreateDllForAreaOfRectangle
{
public class AreaOfRectangle : CodeActivity
{
[Category("Input")]
public InArgument<int> Length { get; set; }
[Category("Input")]
public InArgument<int> Breadth { get; set; }
[Category("Output")]
public OutArgument<int> Area { get; set; }
protected override void Execute(CodeActivityContext context)
{
try
{
var len = Length.Get(context);
var brdth = Breadth.Get(context);
var dummy = len * brdth;
Area.Set(context,dummy);
}
catch
{
throw new NotImplementedException();
}
}
}
}