/// /// Copyright © 2003-2008 JetBrains s.r.o. /// You may distribute under the terms of the GNU General Public License, as published by the Free Software Foundation, version 2 (see License.txt in the repository root folder). /// using System; using Microsoft.Build.Framework; namespace JetBrains.Build.Common.Infra { /// /// A task that defines task input parameters for defining the VS hive. /// public abstract class VsHiveTask : TaskBase { #region Attributes /// /// Gets or sets the Visual Studio root suffix to work with, a dash “-” means no hive. /// Example: “-” (main hive), “ReSharper” (experimental hive). /// and together form the Visual Studio Hive. /// [Required] public string VsRootSuffix { get { return (string)Bag[AttributeName.VsRootSuffix]; } set { if(value == null) throw new ArgumentNullException("value"); Bag[AttributeName.VsRootSuffix] = value; } } /// /// Gets or sets the Visual Studio version to work with. /// Example: “8.0”. /// and together form the Visual Studio Hive. /// [Required] public string VsVersion { get { return (string)Bag[AttributeName.VsVersion]; } set { if(value == null) throw new ArgumentNullException("value"); Bag[AttributeName.VsVersion] = value; } } #endregion #region Implementation /// /// Gets the Visual Studio hive, which is a concatenation of the version and the hive. /// protected string GetVsHive() { return GetVsVersion() + GetVsRootSuffix(); } /// /// Gets the Visual Studio root suffix, checks that it's been defined. /// Replaces the dash special value “-” with an empty root suffix. /// protected string GetVsRootSuffix() { string retval = GetStringValue(AttributeName.VsRootSuffix); return retval == "-" ? "" : retval; } /// /// Gets the Visual Studio version, checks that it's been defined. /// protected string GetVsVersion() { return GetStringValue(AttributeName.VsVersion); } #endregion } }