From b5e69927535d13ce39a721d44f7d151a72ebec17 Mon Sep 17 00:00:00 2001 From: Rainer Sigwald Date: Mon, 28 Jan 2019 10:56:04 -0600 Subject: [PATCH 1/2] MSBuild: document GetFileHash task --- docs/msbuild/getfilehash-task.md | 67 ++++++++++++++++++++++++++ docs/msbuild/msbuild-task-reference.md | 5 +- 2 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 docs/msbuild/getfilehash-task.md 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..eeb7c218293 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) From 23c05736a45cb6e4443d5f0e24566cee76e6c753 Mon Sep 17 00:00:00 2001 From: Rainer Sigwald Date: Mon, 28 Jan 2019 11:15:27 -0600 Subject: [PATCH 2/2] MSBuild: Document VerifyFileHash task --- docs/msbuild/msbuild-task-reference.md | 3 ++ docs/msbuild/verifyfilehash-task.md | 66 ++++++++++++++++++++++++++ 2 files changed, 69 insertions(+) create mode 100644 docs/msbuild/verifyfilehash-task.md diff --git a/docs/msbuild/msbuild-task-reference.md b/docs/msbuild/msbuild-task-reference.md index eeb7c218293..e873c6e4a9d 100644 --- a/docs/msbuild/msbuild-task-reference.md +++ b/docs/msbuild/msbuild-task-reference.md @@ -208,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