Hi Ross,
Just checked with very similar code and it worked without issues.
Steps taken:
- Build the dll in release.
- Create nuget package and place the dll there (under lib folder)
- Place nuget package in one of configured locations
- Import the package (Note: Filter Activities filters by nuget metadata ID field for .Contains(“Activities”), your package has “Activity” instead, that’s why it doesn’t see it initially).
- Put a writeline activity and manually typed fully qualified method name (in my case CustomActivityTest.Greetings.Greet). This forced UiPath to import the namespace. If it still shows the error, try restarting UiStudio.
My code below.
``using System;
using System.Activities.Presentation.Metadata;
namespace CustomActivityTest
{
///
/// Description of MyClass.
///
public class Greetings : IRegisterMetadata
{
public static string Greet()
{
return “Hello all!”;
}
#region IRegisterMetadata implementation
public void Register()
{
}
#endregion
}
}``
As a sidenote - in the long run I’ve found it much easier to create activity accessors (a CodeActivity derived class that just calls the function). It makes importing much more reliable and also after that you can use both the classes themselves or activities (makes it easier for less technical designers).
Regards.