Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 7 Next »

CodeSmith uses the GetFileName method to provide a default output filename for the template when it's called from the CodeSmith Generator Console Application. This is also used in CodeSmith GeneratorĀ as the default file name if you save the output of a template, and anywhere else that CodeSmith GeneratorĀ needs to assign a filename to the output of your template. You can override this method in your code when you want to build the default file name based on property input or other factors.

For example, if your C# language template contains a property named ClassName, you might include this code to set the default output file name:

<script runat="template">
public override string GetFileName()
{
    return ClassName + ".cs";
}
</script>
  • No labels