【问题标题】:Language neutral custom tool语言中立的自定义工具
【发布时间】:2010-12-25 04:03:01
【问题描述】:

我正在开发一个 DSL 工具,对于这个工具,有一个自定义代码生成工具可以创建输出文件。目前,此工具是使用 DslPackage 上的 RegistrationAttribute 向 C# 注册的,代码如下:

class FileGenerationRegistrationAttribute : RegistrationAttribute
{
    private const string CSharpGeneratorsGuid = "{fae04ec1-301f-11d3-bf4b-00c04f79efbc}";
    private const string CSharpProjectGuid = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}";

    public override void Register( RegistrationAttribute.RegistrationContext context )
    {
        // register custom generator
        key = context.CreateKey( @"Generators\ " + CSharpGeneratorsGuid );
        ...
        key.Close();

        // register editor notification
        key = context.CreateKey( @"Projects\ " + CSharpProjectGuid + @"\FileExtensions" );
        ...
        key.Close();
    }
}

这可行,但问题是,该工具生成的代码将是语言中立的(通过使用 CodeDOM)。它不需要项目是 C# 类型。所以我的问题是:为了让我的工具可用于任何类型的项目,我可以使用哪些 GUID 而不是演示的 CSharpGeneratorsGuidCSharpProjectGuid? (如 VB、F#、IronPython 等)

【问题讨论】:

  • 不幸的是,我自己的研究告诉我这是不可能的,所以我真的希望有人能提供比这更好的消息。

标签: visual-studio code-generation dsl customtool


【解决方案1】:

我找了又找,但没有找到答案,我真的开始相信没有答案。证明我错了(是的,请证明我错了),我会将您的答案标记为已接受的答案。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-09-04
    • 1970-01-01
    • 1970-01-01
    • 2015-04-22
    • 1970-01-01
    • 2015-02-20
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多