为什么我的自定义宏没有出现在模板资源管理器中?
Why isn't my custom macro showing up at template explorer?
我正在尝试为 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>
提前致谢!
插件是否完全由 ReSharper 加载?您需要确保已设置 "zones"。检查此 Troubleshooting guide 可能未正确安装的原因。
我正在尝试为 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>
提前致谢!
插件是否完全由 ReSharper 加载?您需要确保已设置 "zones"。检查此 Troubleshooting guide 可能未正确安装的原因。