1. Create a user code collection in one project & build the project
2. Create a new project and add the previous project from step 1 as a .NET assembly reference
3. In the new project, open a recording module, click the Add New Action ->User Code->Select from library
You will see that the static user code methods from your referenced user code project do not show up!
The fix I found for this is to change the user code collection class to explicitly make it static, e.g. from:
Code: Select all
[UserCodeCollection]
public class UserCodeCollection1
{
[UserCodeMethod]
public static void Invoke_KP()
{
Host.Local.RunApplication(@"C:\Program Files (x86)\KeePass Password Safe 2\KeePass.exe");
}
}
Code: Select all
[UserCodeCollection]
public static class UserCodeCollection1
{
[UserCodeMethod]
public static void Invoke_KP()
{
Host.Local.RunApplication(@"C:\Program Files (x86)\KeePass Password Safe 2\KeePass.exe");
}
}
It's strange as in a user code collection all the methods are static, and calls to methods do not use instantiation, so could Ranorex get it to add the static declaration automatically, as this would make it easy for users to use user code methods in other projects point and click?