TeamCity 4.0 Help

Duplicates Finder (.NET)

This page contains reference information about the .NET Duplicates Finder Build Runner fields. The .NET Duplicates Finder Build Runner is intended for catching similar code fragments and providing a report on discovered repetitive blocks of C# and Visual Basic .NET code in Visual Studio 2003, 2005 and 2008 solutions.

In this section:

Option

Description

Build runner

Select Duplicates Finder (.NET) from the drop-down list.

Sources

Option

Description

Solution file path

Enter the path, relative to the Build Checkout Directory, to the Visual Studio 2003, 2005 or 2008 solution file.

Working directory

Specify build working directory, if it differs from the build checkout directory.

Duplicate Searcher Settings

Option

Description

Fragments comparison

Use these options to define which elements of the source code should be discarded when searching for repetitive code fragments. Code fragments can be considered duplicated, if they are structurally similar, but contain different variables, fields, methods, types or literals. Refer to the samples below:

Normalize types to last subtype

If this option is checked, similar contents with different namespace specifications will be recognized as duplicates.

NLog.Logger.GetInstance().Log("abcd"); A.Log.Logger.GetInstance().Log("abcd");

Discard literals

If this option is checked, similar lines of code with different literals will be recognized as duplicates.

myStatusBar.SetText("Not Logged In"); myStatusBar.SetText("Logging In...");

Discard local variables

If this option is checked, similar code fragments with different local variable names will be recognized as duplicates.

int a = 5; a += 6; int b = 5; b += 6;

Discard class fields name

If this option is checked, the similar code fragments with different field names will be recognized as duplicates.

Console.WriteLine(myFoo); Console.WriteLine(myBar); ... where myFoo and myBar are declared in the containing class

Discard types

If this option is checked, similar content with different type names will be recognized as duplicates. That includes all possible type references (as shown below):

Logger.GetInstance("text"); OtherUtility.GetInstance("text"); ... where Logger and OtherUtility are both type names (thus GetInstance is a static method in both classes) Logger a = (Logger) GetObject("object"); OtherUtility a = (OtherUtility) GetObject("object"); public int SomeMethod(string param); public void SomeMethod(object[] param);

Ignore duplicates with complexity simpler than

Use this field to specify the lowest level of complexity of code blocks to be taken into consideration when detecting duplicates.

Skip files by mask

Enter files and wildcards to exclude files from the duplicates search (for example, *_generated.cs). Multiple entries should be separated by semicolon character. Every wildcard will be applied to full file path in Windows format (i.e. C:\a\b\c\myfile.cs) ignoring the case: * \c\ * will match the file name above.

Skip files with opening comment

Enter semicolon-separated keywords to exclude files that contain the keyword in a file's opening comments from the duplicates search.

Skip regions by message substring

Enter semicolon-separated keywords that exclude regions that contain the keyword in the message substring from the duplicates search. Entering "generated code", for example, will skip regions containing "Windows Form Designer generated code".

Debug

Check this option to include debug messages in the build log

Last modified: 20 April 2023