Paulo Morgado

.NET Development & Architecture

This Blog

Syndication

Search

Tags

News

Unit Test Today! Get Typemock Isolator!

Projects

Books

 

Visitors

Visitor Locations

Community

Email Notifications

Archives

Profile

Disclaimer

The opinions and viewpoints expressed in this site are mine and do not necessarily reflect those of Microsoft, my employer or any community that I belong to. Any code or opinions are offered as is. Products or services mentioned are purchased by me, made available to me by my employer or the manufacturer/vendor which doesn't influence my opinion in any way.

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>
//-----------------------------------------------------------------------

Published Wed, Apr 7 2010 1:47 by Paulo Morgado

Comments

# Community: CodeIt.Right and CruiseControl.NET; File Header Template for StyleCop@ Tuesday, April 06, 2010 11:54 PM

We are added 2 new community contributions to our Tutorials page. Paulo Morgado posted a great template

SubMain Blog

# re: CodeIt.Right Code File Header Template For StyleCop Rules@ Monday, January 16, 2012 3:08 PM

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

Daby Schuurmans

# re: CodeIt.Right Code File Header Template For StyleCop Rules@ Monday, January 16, 2012 6:14 PM

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.

Paulo Morgado

Leave a Comment

(required) 
(required) 
(optional)
(required) 
If you can't read this number refresh your screen
Enter the numbers above: