# 11 Ekim 2006 Çarşamba
I can't dechiper legal documents even in Turkish, how can I decide if I'm allowed to release the source code or not by looking at the VS DSK license? If Microsoft has a department or something to ask "would you get angry if I release this?", I want to know.

Anyway, you can download the source of ActiveWriter Preview here. I have removed some .tt files copyrighted by Microsoft, but instructions are available in the download to add them from an empty DSL Tools project. Lack of .tt files will prevent any "just extract and open" scenario, sorry about that.

Back to the license adventure. I have asked in DSL Tools forum if it's possible to release the source, and directed to the SDK license. Then I found a post on Interop blog, saying that "It is possible to release extensions to Visual Studio under open source licenses" with an IANAL notice. I have convinced that I can, until I notice copyright notes on all over the .tt files, which are very much the core of the code generation on DSL Tools part. So I followed the next best approach, removed copyrighted stuff.

Having copyright notices in .tt files, for Microsoft, is a bit silly, by the way. They don't include notices in AssemblyInfo or config files (or any other template generated solution files), what's different with .tt's?


Gareth Jones from DSL Tools team replied, saying that .tt files are considered to be samples and developers may customize them with whatever license statements they have. This is extremely good. I'll re-release the source with all the .tt files included.

And for those who don't know what a .tt file is for; they are input files for the text templating engine of DSL Tools. They have ASP.NET like <# #> syntax to generate output as VS solution files. Very handy, but I prefered a more classic approach in ActiveWriter. CodeGenerationHelper is much nicer in plain C# than .tt syntax.

ActiveWriterReport.tt file:

<#@ template inherits="Microsoft.VisualStudio.TextTemplating.VSHost.ModelingTextTransformation" debug="true"#>
<#@ output extension=".%EXT%" #>
<#@ ActiveWriter processor="ActiveWriterDirectiveProcessor" requires="fileName='%MODELFILE%'" #>
<#@ import namespace="Altinoren.ActiveWriter.CodeGeneration" #>
    CodeGenerationHelper helper = new CodeGenerationHelper(this.Model, "%NAMESPACE%");

and the usage:

protected override byte[] GenerateCode(string inputFileName, string inputFileContent)


    ResourceManager manager =

        new ResourceManager("Altinoren.ActiveWriter.VSPackage",

                            typeof (ActiveWriterTemplatedCodeGenerator).Assembly);

    FileInfo fi = new FileInfo(inputFileName);

    inputFileContent =

        manager.GetObject("ActiveWriterReport").ToString().Replace("%MODELFILE%", fi.Name).Replace(

            "%NAMESPACE%", FileNameSpace).Replace("%EXT%", "cs"); // TODO: Get file extension from the project model


    byte[] data = base.GenerateCode(inputFileName, inputFileContent);

    return data;