namespace MSBuild.Tasks
open System
open System.IO
open System.Security.Cryptography
open Microsoft.Build.Utilities
open Microsoft.Build.Framework
open System.IO
open System.Security.Cryptography
open Microsoft.Build.Utilities
open Microsoft.Build.Framework
type Md5Sum() =
inherit Task()
inherit Task()
let mutable inputFile = ""
let mutable md5Value = ""
[<Required>]
member this.InputFile
with get() = inputFile
and set(v) = inputFile <- v
[<Output>]
member this.Md5Value
with get() = md5Value
and set(v) = md5Value <- v
override this.Execute() =
let resultCode =
try
base.Log.LogMessage( MessageImportance.Normal, "Computing MD5 hash for {0}", inputFile)
let md5csp = MD5CryptoServiceProvider. Create()
let md5Value = inputFile |> File.ReadAllBytes |> md5csp.ComputeHash |> Convert.ToBase64String
base.Log.LogMessage( MessageImportance.Normal, "Computed MD5 hash is {0}", md5Value.ToString())
true
with
| _ as ex -> base.Log. LogErrorFromException(ex, false); false
resultCode
let resultCode =
try
base.Log.LogMessage(
let md5csp = MD5CryptoServiceProvider.
let md5Value = inputFile |> File.ReadAllBytes |> md5csp.ComputeHash |> Convert.ToBase64String
base.Log.LogMessage(
true
with
| _ as ex -> base.Log.
resultCode
No comments:
Post a Comment