UIPath : Custom namespace method not working

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!!!

Please aid on this issue!!

1 Like

Here are the steps how to add the DLL to the UiPath packages… @kandaguru_baskaran Ofcourse you have done it already,…

  1. Select c# Class Library
  2. Add references system.activities and system.componentModel;
  3. Write the required code to be executed
  4. Define the input and output parameters
  5. build the solution
  6. Go to the containing folder and open bin folder
  7. open the Nuget explorer and create new library and add the dll selecting the add existing option
  8. Click to edit and change the name of the package
  9. 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
  10. 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

    public InArgument<int> Length { get; set; }

    public InArgument<int> Breadth { get; set; }

    public OutArgument<int> Area { get; set; }

    protected override void Execute(CodeActivityContext context)
            var len = Length.Get(context);
            var brdth = Breadth.Get(context);
            var dummy = len * brdth;
            throw new NotImplementedException();

Have a look if you are missing anything :slight_smile: