diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2010-08-07 14:38:54 -0700 |
---|---|---|
committer | Andrew Arnott <andrewarnott@gmail.com> | 2010-08-07 14:38:54 -0700 |
commit | e7ce41355c38b3125729a62920231f274b7a2100 (patch) | |
tree | 5f72a002a9b839e8fbcb694dfafee533a0e644f6 /src/DotNetOpenAuth.BuildTasks/SnToolTask.cs | |
parent | a000d147d61fb0335983a43e9f930f7a1ca60104 (diff) | |
parent | 23499563a7773abc203dae9d96c1c0b84897159b (diff) | |
download | DotNetOpenAuth-origin/v3.2.zip DotNetOpenAuth-origin/v3.2.tar.gz DotNetOpenAuth-origin/v3.2.tar.bz2 |
Merge branch 'v3.1' into v3.2origin/v3.2
Diffstat (limited to 'src/DotNetOpenAuth.BuildTasks/SnToolTask.cs')
-rw-r--r-- | src/DotNetOpenAuth.BuildTasks/SnToolTask.cs | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/DotNetOpenAuth.BuildTasks/SnToolTask.cs b/src/DotNetOpenAuth.BuildTasks/SnToolTask.cs new file mode 100644 index 0000000..29896fe --- /dev/null +++ b/src/DotNetOpenAuth.BuildTasks/SnToolTask.cs @@ -0,0 +1,37 @@ +//----------------------------------------------------------------------- +// <copyright file="SnToolTask.cs" company="Andrew Arnott"> +// Copyright (c) Andrew Arnott. All rights reserved. +// </copyright> +//----------------------------------------------------------------------- + +namespace DotNetOpenAuth.BuildTasks { + using System; + using System.IO; + using Microsoft.Build.Utilities; + + public abstract class SnToolTask : ToolTask { + /// <summary> + /// Gets the name of the tool. + /// </summary> + /// <value>The name of the tool.</value> + protected override string ToolName { + get { return "sn.exe"; } + } + + /// <summary> + /// Generates the full path to tool. + /// </summary> + protected override string GenerateFullPathToTool() { + string[] versions = new[] { "v6.0A", "v6.1", "v7.0a" }; + string fullPath = null; + foreach (string version in versions) { + fullPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), @"Microsoft SDKs\Windows\" + version + @"\bin\" + this.ToolName); + if (File.Exists(fullPath)) { + return fullPath; + } + } + + throw new FileNotFoundException("Unable to find sn.exe tool.", fullPath); + } + } +} |