CodeIt.Right Code File Header Template For StyleCop Rules

I like to use both StyleCop and CodeIt.Right to validate my code – StyleCop because it’s free and CodeIt.Right because it’s really good.

While StyleCop provides only validation, CodeIt.Righ provides both validation and correction of violations.

Unfortunately, CodeIt.Right’s supplied template for code file headers does not conform to StyleCop rules.

Fortunately, CodeIt.Right allows us to define our own template. Here’s the one I use:

<#@ template language="C#" #>
//-----------------------------------------------------------------------
// <copyright file="<#= System.IO.Path.GetFileName(Context.DestinationFile) #>"
//            project="<#= Context.ProjectName #>"
//            assembly="<#= Context.AssemblyName #>"
//            solution="<#= Context.SolutionName #>"
//            company="<#= Context.GetGlobalProperty("CompanyName") #>">
//     Copyright (c) <#= Context.GetGlobalProperty("CompanyName") #>. All rights reserved.
// </copyright>
// <author id="<#= Context.GetGlobalProperty("UserID") #>"><#= Context.GetGlobalProperty("UserName") #></author>
// <summary></summary>
//-----------------------------------------------------------------------

2 Responses to CodeIt.Right Code File Header Template For StyleCop Rules

  • Daby Schuurmans says:

    Good Afternoon:

    I am really newbie at learning coding in C# and/or ASP .NET (AJAX) and was wondering about the Context.DestinationFile it references. Can you use your header in a C# console application or is this only for web usage?

    Thanks

    Daby Schuurmans

  • paulo says:

    I don’t think I understand your question, Daby.

    This post is about CodeIt,Right templates. It applies to any C# source file on any C# project type, providing you have CodeIt.Right installed.