//----------------------------------------------------------------------- // // Copyright (c) Outercurve Foundation. All rights reserved. // //----------------------------------------------------------------------- namespace DotNetOpenAuth.BuildTasks { using System; using System.IO; using Microsoft.Build.Utilities; public abstract class SnToolTask : ToolTask { /// /// Gets the name of the tool. /// /// The name of the tool. protected override string ToolName { get { return "sn.exe"; } } /// /// Generates the full path to tool. /// 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); } } }