diff options
Diffstat (limited to 'main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildFileFormat.cs')
-rw-r--r-- | main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildFileFormat.cs | 174 |
1 files changed, 59 insertions, 115 deletions
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildFileFormat.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildFileFormat.cs index d3084e8e19..e35886fdfe 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildFileFormat.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildFileFormat.cs @@ -67,21 +67,19 @@ namespace MonoDevelop.Projects.MSBuild return GetSupportedFormats ().Where (f => f.CanWriteFile (targetItem)); } - public static MSBuildFileFormat DefaultFormat { - get { return VS2012; } - } + public static MSBuildFileFormat DefaultFormat => VS2012; - public string Name { - get { return "MSBuild"; } - } + [Obsolete ("Use ProductDescription or ID")] + public string Name => "MSBuild"; + [Obsolete] public abstract Version Version { get; } internal SlnFileFormat SlnFileFormat { get { return slnFileFormat; } } - public bool SupportsMonikers { get { return SupportedFrameworks == null; } } + public bool SupportsMonikers => SupportedFrameworks == null; public static bool ToolsSupportMonikers (string toolsVersion) { @@ -198,8 +196,16 @@ namespace MonoDevelop.Projects.MSBuild public virtual string DefaultSchemaVersion { get { return null; } } + /// <summary> + /// Product description for display in UI + /// </summary> public abstract string ProductDescription { get; } + /// <summary> + /// Product description for comment in new sln files + /// </summary> + public virtual string ProductDescriptionComment => ProductDescription; + public virtual TargetFrameworkMoniker[] SupportedFrameworks { get { return null; } }
@@ -226,49 +232,39 @@ namespace MonoDevelop.Projects.MSBuild public abstract string Id { get; } } - - class MSBuildFileFormatVS05: MSBuildFileFormat - { - static readonly TargetFrameworkMoniker[] supportedFrameworks = { - TargetFrameworkMoniker.NET_2_0, - }; - - public override string Id { - get { return "MSBuild05"; } - } - - public override Version Version { - get { return new Version ("2005"); } - } - - public override string DefaultProductVersion { - get { return "8.0.50727"; } - } - - public override string DefaultToolsVersion { - get { return "2.0"; } - } - public override string DefaultSchemaVersion { - get { return "2.0"; } - } + class MSBuildFileFormatVS05 : MSBuildFileFormat + { + public override string Id => "MSBuild05"; - public override string SlnVersion { - get { return "9.00"; } - } + [Obsolete("Unused")] + public override Version Version => new Version ("2005"); - public override string ProductDescription { - get { return "Visual Studio 2005"; } - } + public override string DefaultProductVersion => "8.0.50727"; + public override string DefaultToolsVersion => "2.0"; + public override string DefaultSchemaVersion => "2.0"; + public override string SlnVersion => "9.00"; + public override string ProductDescription => "Visual Studio 2005"; - public override TargetFrameworkMoniker[] SupportedFrameworks { - get { return supportedFrameworks; } - } + public override TargetFrameworkMoniker [] SupportedFrameworks { get; } = { + TargetFrameworkMoniker.NET_2_0, + }; } class MSBuildFileFormatVS08: MSBuildFileFormat { - static readonly TargetFrameworkMoniker[] supportedFrameworks = { + public override string Id => "MSBuild08"; + + [Obsolete ("Unused")] + public override Version Version => new Version ("2008"); + + public override string DefaultProductVersion => "9.0.21022"; + public override string DefaultToolsVersion => "3.5"; + public override string DefaultSchemaVersion => "2.0"; + public override string SlnVersion => "10.00"; + public override string ProductDescription => "Visual Studio 2008"; + + public override TargetFrameworkMoniker [] SupportedFrameworks { get; } = { TargetFrameworkMoniker.NET_2_0, TargetFrameworkMoniker.NET_3_0, TargetFrameworkMoniker.NET_3_5, @@ -277,97 +273,45 @@ namespace MonoDevelop.Projects.MSBuild TargetFrameworkMoniker.MONOTOUCH_1_0, }; - public override string Id { - get { return "MSBuild08"; } - } - - public override Version Version { - get { return new Version ("2008"); } - } - - public override string DefaultProductVersion { - get { return "9.0.21022"; } - } - - public override string DefaultToolsVersion { - get { return "3.5"; } - } - - public override string DefaultSchemaVersion { - get { return "2.0"; } - } - - public override string SlnVersion { - get { return "10.00"; } - } - - public override string ProductDescription { - get { return "Visual Studio 2008"; } - } - - public override TargetFrameworkMoniker[] SupportedFrameworks { - get { return supportedFrameworks; } - } } class MSBuildFileFormatVS10: MSBuildFileFormat { - public override string Id { - get { return "MSBuild10"; } - } - - public override Version Version { - get { return new Version ("2010"); } - } + public override string Id => "MSBuild10"; - //WTF VS - public override string DefaultProductVersion { - get { return "8.0.30703"; } - } - - public override string DefaultSchemaVersion { - get { return "2.0"; } - } - - public override string DefaultToolsVersion { - get { return "4.0"; } - } - - public override string SlnVersion { - get { return "11.00"; } - } + [Obsolete ("Unused")] + public override Version Version => new Version ("2010"); - public override string ProductDescription { - get { return "Visual Studio 2010"; } - } + public override string DefaultProductVersion => "8.0.30703"; + public override string DefaultSchemaVersion => "2.0"; + public override string DefaultToolsVersion => "4.0"; + public override string SlnVersion => "11.00"; + public override string ProductDescription => "Visual Studio 2010"; } // this is actually VS2010 SP1 and later class MSBuildFileFormatVS12: MSBuildFileFormat { - public override string Id { - get { return "MSBuild12"; } - } + public override string Id => "MSBuild12"; - public override Version Version { - get { return new Version ("2012"); } - } + [Obsolete ("Unused")] + public override Version Version => new Version ("2012"); - public override string DefaultToolsVersion { - get { return "4.0"; } - } + // This is mostly irrelevant, the builder always uses the latest + // tools version. It's only used for new projects created with + // the old project template engine. + public override string DefaultToolsVersion => "4.0"; - public override string SlnVersion { - get { return "12.00"; } - } + public override string SlnVersion => "12.00"; - public override string ProductDescription { - get { return "Visual Studio 15"; } - } + public override string ProductDescription => "Visual Studio 2012+"; + + // This matches the value used by VS 2017 + public override string ProductDescriptionComment => "Visual Studio 15"; protected override bool SupportsToolsVersion (string version) { - return version == "4.0" || version == "12.0" || version == "14.0" || version == "15.0"; + return Version.TryParse (version, out Version v) && v <= new Version (15, 0); } } } |