Partilhar via


Hash Class

Definition

Generates a hash of a given ItemGroup items. Metadata is not considered in the hash.

public ref class Hash : Microsoft::Build::Tasks::TaskExtension
public class Hash : Microsoft.Build.Tasks.TaskExtension
type Hash = class
    inherit TaskExtension
Public Class Hash
Inherits TaskExtension
Inheritance

Remarks

Currently uses SHA256. Implementation subject to change between MSBuild versions. This class is not intended as a cryptographic security measure, only uniqueness between build executions - collisions can theoretically be possible in the future (should we move to noncrypto hash) and should be handled gracefully by the caller.

Usage of cryptographic secure hash brings slight performance penalty, but it is considered acceptable. Would this need to be revised - XxHash64 from System.Io.Hashing could be used instead for better performance. (That however currently requires load of additional binary into VS process which has it's own costs)

Constructors

Hash()

Properties

BuildEngine

The build engine automatically sets this property to allow tasks to call back into it.

(Inherited from Task)
BuildEngine2

The build engine automatically sets this property to allow tasks to call back into it. This is a convenience property so that task authors inheriting from this class do not have to cast the value from IBuildEngine to IBuildEngine2.

(Inherited from Task)
BuildEngine3

Retrieves the IBuildEngine3 version of the build engine interface provided by the host.

(Inherited from Task)
BuildEngine4

Retrieves the IBuildEngine4 version of the build engine interface provided by the host.

(Inherited from Task)
BuildEngine5

Retrieves the IBuildEngine5 version of the build engine interface provided by the host.

(Inherited from Task)
BuildEngine6

Retrieves the IBuildEngine6 version of the build engine interface provided by the host.

(Inherited from Task)
BuildEngine7

Retrieves the IBuildEngine7 version of the build engine interface provided by the host.

(Inherited from Task)
BuildEngine8

Retrieves the IBuildEngine8 version of the build engine interface provided by the host.

(Inherited from Task)
BuildEngine9

Retrieves the IBuildEngine9 version of the build engine interface provided by the host.

(Inherited from Task)
HashResult

Hash of the ItemsToHash ItemSpec.

HelpKeywordPrefix

Gets or sets the prefix used to compose help keywords from string resource names. If a task does not have help keywords associated with its messages, it can ignore this property or set it to null. If the prefix is set to an empty string, then string resource names will be used verbatim as help keywords. For an example of how this prefix is used, see the TaskLoggingHelper.LogErrorWithCodeFromResources(string, object[]) method.

(Inherited from Task)
HostObject

The build engine sets this property if the host IDE has associated a host object with this particular task.

(Inherited from Task)
IgnoreCase

When true, will generate a case-insensitive hash.

ItemsToHash

Items from which to generate a hash.

Log

This API supports the product infrastructure and is not intended to be used directly from your code.

Gets an instance of a TaskLoggingHelperExtension class containing task logging methods.

(Inherited from TaskExtension)
TaskResources

Gets or sets the task's culture-specific resources. Derived classes should register their resources either during construction, or via this property, if they have localized strings.

(Inherited from Task)

Methods

Execute()

Execute the task.

Applies to