Custom package can't import namespace

hi, kindly help me to resolve the below issue.

I converted dll to nuget file and instakll into uipath, but i cant import my class library

is your package is visible in available packages…??

yeah… its installed and also there in C:\Program Files (x86)\UiPath Studio\Packages. but i can’t import

no in Ui path when you try ti install is it visible under available in packages is my question not in your package directory.?

yeah… it visible

can you please provide what error you are getting when you tried to install the same?

i installed my custom package. when i try to import my class. i cant find anything

after installed my package. i restarted uipath & system also. but i can’t import my class library in Imported Namespaces in UIPath

please check out the link this might help you same way i followed and am able to access my library in ui path

thanks divya… i found answer… we need to add the below class in our custom class library

public class RegisterMetadata : System.Activities.Presentation.Metadata.IRegisterMetadata
{
public void Register()
{
}
}

1 Like

Hi Selvam/Divyashreem,

I created class library in C#, and in that I created one function whose work is send an string as a output. and Class is inherited with IRegisterMetaData.

public class Class1 : IRegisterMetadata
{
public static string GetName(int i)
{
if (i == 1)
{
return “I am one”;
}
else
{
return “I am two”;
}
}

    public void Register()
    {
        
    }
}

Now, I created a package of this dll, and add it in UiPath packages folder and install it from UI.
then I take one assign activity and called the function as
ClassLibrary1.Class1.GetName(1), but when I run this then it gives me an error as mentioned below:

[Window Title]
Workflow Exception

[Main Instruction]
Main has thrown an exception

[Content]
Message: The invoked workflow ‘Main’ has validation errors. Please review the workflow and resolve the errors.

Exception Type: Exception

[Expanded Information]
System.Exception: The invoked workflow ‘Main’ has validation errors. Please review the workflow and resolve the errors. —> System.Activities.InvalidWorkflowException: The following errors were encountered while processing the workflow tree:
‘Main’: The private implementation of activity ‘1: Main’ has the following validation error: Compiler error(s) encountered processing expression “ClassLibrary1.Class1.GetName(1)”.
‘ClassLibrary1’ is not declared. It may be inaccessible due to its protection level.

at System.Activities.Hosting.WorkflowInstance.ValidateWorkflow(WorkflowInstanceExtensionManager extensionManager)
at System.Activities.Hosting.WorkflowInstance.RegisterExtensionManager(WorkflowInstanceExtensionManager extensionManager)
at System.Activities.WorkflowApplication.EnsureInitialized()
at System.Activities.WorkflowApplication.Enqueue(InstanceOperation operation, Boolean push)
at System.Activities.WorkflowApplication.SimpleOperationAsyncResult.Run(TimeSpan timeout)
at System.Activities.WorkflowApplication.BeginRun(AsyncCallback callback, Object state)
at UiPath.Executor.RobotRunner.<>c__DisplayClass49_0.b__0()
— End of inner exception stack trace —

Please help me on this.

Thanks
Harsh