我正在尝试为c#模板开发一个宏,但它根本不起作用。我试过阅读整个(不完整的)文档,或者找一个宏的源代码作为例子,但我都失败了。
我能够构建,安装和调试插件。没有错误,并且调用了构造函数和方法。但是当我访问模板资源管理器中的宏时,没有任何东西显示在那里。我还从选项中选择了All macros
。
这是我的代码
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>
提前致谢!