I'm on the latest hotfix (v13.0.151).
I followed the documentation to add a custom macro method but it doesn't register. Below is what I did:
In a separate assembly (which has a dummy class annotated with [assembly: AssemblyDiscoverable]
) I have my macro methods:
//[assembly: RegisterExtension(typeof(SOSMacroMethods), typeof(SOSMacroNamespace))] //tried with and without
public class SOSMacroMethods : MacroMethodContainer
{
[MacroMethod(typeof(string), "test method", 0)]
public static object MyTestMethod(EvaluationContext context, params object[] parameters)
{
return "yayyy registered";
}
}
And the module and namespaces as so:
[assembly: RegisterModule(typeof(SOSMacroModule))]
public class SOSMacroModule : Module
{
public SOSMacroModule()
: base("SOSMacros")
{
}
protected override void OnInit()
{
base.OnInit();
MacroContext.GlobalResolver.SetNamedSourceData("SOS", SOSMacroNamespace.Instance);
}
}
[Extension(typeof(SOSMacroMethods))]
public class SOSMacroNamespace : MacroNamespace<SOSMacroNamespace>
{
}
I then compiled this and added it to my admin solution as an existing project and added a reference to it too. I then rebuilt the admin solution.
When I go to the admin interface I don't get it in the macro editor and when I try to debug it I get the error log message:
CMS.MacroEngine.EvaluationException: Exception occurred while evaluation of the expression ' <snipped for brevity>': Method 'MyTestMethod' not found, please check the macro or the method declaration.
I get the same issue when trying to resolve the macro on my live site too. Edit: working on live site now though I've made no changes
This works in my K12 Portal solution and from what I can gather the only changes are sharing the macros between presentation and admin in K13.
Is there something I'm missing?