diff --git a/docs/msbuild/getfilehash-task.md b/docs/msbuild/getfilehash-task.md new file mode 100644 index 00000000000..d8022a3d338 --- /dev/null +++ b/docs/msbuild/getfilehash-task.md @@ -0,0 +1,67 @@ +--- +title: "GetFileHash Task | Microsoft Docs" +ms.date: "01/28/2019" +ms.topic: "reference" +f1_keywords: + - "http://schemas.microsoft.com/developer/msbuild/2003#GetFileHash" +dev_langs: + - "VB" + - "CSharp" + - "C++" + - "jsharp" +helpviewer_keywords: + - "GetFileHash task [MSBuild]" + - "MSBuild, GetFileHash task" +ms.assetid: ??? +author: mikejo5000 +ms.author: mikejo +manager: jillfra +ms.workload: + - "multiple" +--- +# GetFileHash task + +Computes checksums of the contents of a file or set of files. + +This task was added in 15.8, but requires a [workaround](https://github.com/Microsoft/msbuild/pull/3999#issuecomment-458193272) to use for MSBuild versions below 16.0. + +## Task parameters + + The following table describes the parameters of the `GetFileHash` task. + +|Parameter|Description| +|---------------|-----------------| +|`Files`|Required `[]` parameter.

The files to be hashed.| +|`Items`|`[]` output parameter.

The `Files` input with additional metadata set to the file hash.| +|`Hash`|`String` output parameter.

The hash of the file. This is only set if there was exactly one item passed in.| +|`Algorithm`|Optional `String` parameter.

The algorithm. Allowed values: `SHA256`, `SHA384`, `SHA512`. Default = `SHA256`.| +|`MetadataName`|Optional `String` parameter.

The metadata name where the hash is stored in each item. Defaults to `FileHash`.| +|`HashEncoding`|Optional `String` parameter.

The encoding to use for generated hashes. Defaults to `hex`. Allowed values = `hex`, `base64`.| + +## Example + +The following example uses the `GetFileHash` task to determine and print the checksum of the `FilesToHash` items. + +```xml + + + + + + + + + + + + +``` + +## See also + +[Tasks](../msbuild/msbuild-tasks.md) + +[Task reference](../msbuild/msbuild-task-reference.md) \ No newline at end of file diff --git a/docs/msbuild/msbuild-task-reference.md b/docs/msbuild/msbuild-task-reference.md index c00c1c3e7f4..e873c6e4a9d 100644 --- a/docs/msbuild/msbuild-task-reference.md +++ b/docs/msbuild/msbuild-task-reference.md @@ -124,7 +124,10 @@ Tasks provide the code that runs during the build process. The tasks in the foll [GetAssemblyIdentity task](../msbuild/getassemblyidentity-task.md) Retrieves the assembly identities from the specified files and outputs the identity information. - [GetFrameworkPath task](../msbuild/getframeworkpath-task.md) + [GetFileHash task](../msbuild/getfilehash-task.md) + Computes checksums of the contents of a file or set of files. + +[GetFrameworkPath task](../msbuild/getframeworkpath-task.md) Retrieves the path to the [!INCLUDE[dnprdnshort](../code-quality/includes/dnprdnshort_md.md)] assemblies. [GetFrameworkSdkPath task](../msbuild/getframeworksdkpath-task.md) @@ -205,6 +208,9 @@ Tasks provide the code that runs during the build process. The tasks in the foll [Vbc task](../msbuild/vbc-task.md) Invokes the Visual Basic compiler to produce executables, dynamic-link libraries, or code modules.. + [VerifyFileHash task](../msbuild/verifyfilehash-task.md) + Verifies that a file matches the expected file hash. + [Warning task](../msbuild/warning-task.md) Logs a warning during a build based on an evaluated conditional statement. diff --git a/docs/msbuild/verifyfilehash-task.md b/docs/msbuild/verifyfilehash-task.md new file mode 100644 index 00000000000..fbc965e9755 --- /dev/null +++ b/docs/msbuild/verifyfilehash-task.md @@ -0,0 +1,66 @@ +--- +title: "VerifyFileHash Task | Microsoft Docs" +ms.date: "01/28/2019" +ms.topic: "reference" +f1_keywords: + - "http://schemas.microsoft.com/developer/msbuild/2003#VerifyFileHash" +dev_langs: + - "VB" + - "CSharp" + - "C++" + - "jsharp" +helpviewer_keywords: + - "VerifyFileHash task [MSBuild]" + - "MSBuild, VerifyFileHash task" +ms.assetid: ??? +author: mikejo5000 +ms.author: mikejo +manager: jillfra +ms.workload: + - "multiple" +--- +# VerifyFileHash task + +Verifies that a file matches the expected file hash. + +This task was added in 15.8, but requires a [workaround](https://github.com/Microsoft/msbuild/pull/3999#issuecomment-458193272) to use for MSBuild versions below 16.0. + +## Task parameters + + The following table describes the parameters of the `VerifyFileHash` task. + +|Parameter|Description| +|---------------|-----------------| +|`File`|Required parameter.

The files to be hashed and validated.| +|`Hash`|Required `String` parameter.

The expected hash of the file.| +|`Items`|`[]` output parameter.

The `Files` input with additional metadata set to the file hash.| +|`Algorithm`|Optional `String` parameter.

The algorithm. Allowed values: `SHA256`, `SHA384`, `SHA512`. Default = `SHA256`.| +|`HashEncoding`|Optional `String` parameter.

The encoding to use for generated hashes. Defaults to `hex`. Allowed values = `hex`, `base64`.| + +## Example + +The following example uses the `VerifyFileHash` task to verify its own checksum. + +```xml + + + + + + + + + + + +``` + +## See also + +[Tasks](../msbuild/msbuild-tasks.md) + +[Task reference](../msbuild/msbuild-task-reference.md) \ No newline at end of file