Why isn't my custom macro showing up at template explorer?

101 views Asked by At

I am trying to develop a macro for c# templates, but it simply doesn't work. I have tried reading the whole (incomplete) documentation, or find the source code of a macro to use as an example, but I failed on both.

I am able to build, install and debug the plugin. No errors, and both constructors and methods are called. But when I access the macros inside the templates explorer, nothing shows up there. I have also selected All macros from the options.

Here is my code

MyMacroDefinition.cs

[MacroDefinition("Subeta.Abp.ReSharper", LongDescription = "Long Description", Name = "My Name", Requirement = InstantiationRequirement.Instant, ShortDescription = "Short Description")]
public class MyMacroDefinition : SimpleMacroDefinition
{
    public MyMacroDefinition()
    {

    }
}

MyMacroImplementation.cs

[MacroImplementation(Definition = typeof(MyMacroDefinition), Requirement = InstantiationRequirement.Instant)]
public class MyMacroImplementation : SimpleMacroImplementation
{
    private IMacroParameterValueNew myArgument;

    public MyMacroImplementation([Optional] MacroParameterValueCollection arguments)
    {
        myArgument = arguments.OptionalFirstOrDefault();
    }

    public override string EvaluateQuickResult(IHotspotContext context)
    {
        return myArgument == null ? null : myArgument.GetValue().ToUpperInvariant();
    }
}

Subeta.Abp.ReSharper.nuspec

<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
  <metadata>
    <id>Subeta.Abp.ReSharper</id>
    <title>Abp Support</title>
    <version>1.0.2</version>
    <authors>Subeta</authors>
    <owners>Subeta</owners>
    <summary>ReSharper support for ASP.NET Boilerplate framework</summary>
    <description>
      Required desc
    </description>
    <releaseNotes>
    </releaseNotes>
    <requireLicenseAcceptance>false</requireLicenseAcceptance>
    <dependencies>
      <dependency id="Wave" version="[11.0]" />
    </dependencies>
    <tags>aspnetboilerplate abp</tags>
  </metadata>
  <files>
    <file src="bin\Debug\Subeta.Abp.ReSharper.dll" target="DotFiles" />
    <file src="bin\Debug\Subeta.Abp.ReSharper.pdb" target="DotFiles" />
  </files>
</package>

Thanks in advance!

1

There are 1 answers

1
citizenmatt On BEST ANSWER

Does the plugin get loaded by ReSharper at all? You need to make sure you have "zones" set up. Check this Troubleshooting guide for reasons why it might not have installed correctly.