语言中立自定义工具

时间:2009-12-10 08:30:16

标签: visual-studio code-generation dsl customtool

我正在开发一个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等等)

1 个答案:

答案 0 :(得分:0)

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