diff options
author | Jose Miguel Torres <jostor@microsoft.com> | 2019-07-03 15:50:22 +0300 |
---|---|---|
committer | Jose Miguel Torres <jostor@microsoft.com> | 2019-07-13 23:10:04 +0300 |
commit | d4b43d758594ebe92797fbb863d2dd501577b549 (patch) | |
tree | 20cd3b0bf765d97ee6c9c2e3f5d9c3198ee22f82 /main/src/core/MonoDevelop.Core | |
parent | 637d6004e8333b5a65b14bf825ffc4e1e38eeea7 (diff) |
[Ide] Turns AppendTargetFrameworkToOutput prop nullable
So that only when .NET Core / Standard project is loaded a boolean value is set. Otherwise is null, that's .NET Fx
Diffstat (limited to 'main/src/core/MonoDevelop.Core')
-rw-r--r-- | main/src/core/MonoDevelop.Core/MonoDevelop.Projects/DotNetProjectConfiguration.cs | 89 |
1 files changed, 34 insertions, 55 deletions
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/DotNetProjectConfiguration.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/DotNetProjectConfiguration.cs index 62c29ad908..5f6755bbe6 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/DotNetProjectConfiguration.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/DotNetProjectConfiguration.cs @@ -27,15 +27,11 @@ // using System; -using System.Collections; -using System.IO; using System.Linq; using MonoDevelop.Core; -using MonoDevelop.Core.Serialization; using MonoDevelop.Core.Assemblies; using MonoDevelop.Core.StringParsing; using System.Collections.Generic; -using MonoDevelop.Projects.MSBuild; namespace MonoDevelop.Projects { @@ -53,7 +49,7 @@ namespace MonoDevelop.Projects DotNetCompilerParameters compilationParameters; - public bool AppendTargetFrameworkToOutputPath { get; set; } + public bool? AppendTargetFrameworkToOutputPath { get; set; } public string TargetFrameworkShortName { get; internal set; } = string.Empty; public DotNetProjectConfiguration (string id): base (id) @@ -64,15 +60,16 @@ namespace MonoDevelop.Projects { base.Read (pset); - AppendTargetFrameworkToOutputPath = pset.GetValue<bool> ("AppendTargetFrameworkToOutputPath"); + //we are assuming that if AppendTargetFrameworkToOutputPath has a value is .NET Core / .NET Standard proj. + AppendTargetFrameworkToOutputPath = pset.GetValue<bool?> ("AppendTargetFrameworkToOutputPath", defaultValue: null); TargetFrameworkShortName = pset.GetValue ("TargetFramework"); assembly = pset.GetValue ("AssemblyName"); - signAssembly = pset.GetValue<bool> ("SignAssembly"); - delaySign = pset.GetValue<bool> ("DelaySign"); + SignAssembly = pset.GetValue<bool> ("SignAssembly"); + DelaySign = pset.GetValue<bool> ("DelaySign"); PublicSign = pset.GetValue<bool> (nameof(PublicSign)); - assemblyKeyFile = pset.GetPathValue ("AssemblyOriginatorKeyFile", FilePath.Empty); - if (string.IsNullOrEmpty (assemblyKeyFile)) - assemblyKeyFile = pset.GetPathValue ("AssemblyKeyFile", FilePath.Empty); + AssemblyKeyFile = pset.GetPathValue ("AssemblyOriginatorKeyFile", FilePath.Empty); + if (string.IsNullOrEmpty (AssemblyKeyFile)) + AssemblyKeyFile = pset.GetPathValue ("AssemblyKeyFile", FilePath.Empty); if (compilationParameters != null) compilationParameters.Read (pset); } @@ -81,43 +78,30 @@ namespace MonoDevelop.Projects { base.Write (pset); pset.SetValue ("AssemblyName", assembly, mergeToMainGroup: true); - pset.SetValue ("SignAssembly", signAssembly, defaultValue:false, mergeToMainGroup: true); - pset.SetValue ("DelaySign", delaySign, defaultValue:false, mergeToMainGroup:true); + pset.SetValue ("SignAssembly", SignAssembly, defaultValue:false, mergeToMainGroup: true); + pset.SetValue ("DelaySign", DelaySign, defaultValue:false, mergeToMainGroup:true); pset.SetValue (nameof(PublicSign), PublicSign, defaultValue: false, mergeToMainGroup: true); - pset.SetValue ("AssemblyOriginatorKeyFile", assemblyKeyFile, defaultValue:FilePath.Empty, mergeToMainGroup:true); - if (AppendTargetFrameworkToOutputPath) { + pset.SetValue ("AssemblyOriginatorKeyFile", AssemblyKeyFile, defaultValue:FilePath.Empty, mergeToMainGroup:true); + if (compilationParameters != null) + compilationParameters.Write (pset); + + if (AppendTargetFrameworkToOutputPath == null || AppendTargetFrameworkToOutputPath == true) { pset.RemoveProperty (nameof (AppendTargetFrameworkToOutputPath)); } else { pset.SetValue (nameof (AppendTargetFrameworkToOutputPath), false); } - if (compilationParameters != null) - compilationParameters.Write (pset); - } - - private bool signAssembly = false; - public bool SignAssembly { - get { return signAssembly; } - set { signAssembly = value; } - } - - private bool delaySign = false; - public bool DelaySign { - get { return delaySign; } - set { delaySign = value; } } + public bool SignAssembly { get; set; } = false; + public bool DelaySign { get; set; } = false; public bool PublicSign { get; set; } internal string OldAssemblyKeyFile { - set { assemblyKeyFile = value; } + set { AssemblyKeyFile = value; } } - private FilePath assemblyKeyFile = FilePath.Empty; - public FilePath AssemblyKeyFile { - get { return assemblyKeyFile; } - set { assemblyKeyFile = value; } - } - + public FilePath AssemblyKeyFile { get; set; } = FilePath.Empty; + public virtual string OutputAssembly { get { return assembly; } set { assembly = value; } @@ -125,11 +109,10 @@ namespace MonoDevelop.Projects public virtual CompileTarget CompileTarget { get { - DotNetProject prj = ParentItem as DotNetProject; - if (prj != null) + if (ParentItem is DotNetProject prj) return prj.CompileTarget; - else - return CompileTarget.Library; + + return CompileTarget.Library; } } @@ -150,21 +133,19 @@ namespace MonoDevelop.Projects public TargetFramework TargetFramework { get { - DotNetProject prj = ParentItem as DotNetProject; - if (prj != null) + if (ParentItem is DotNetProject prj) return prj.TargetFramework; - else - return Services.ProjectService.DefaultTargetFramework; + + return Services.ProjectService.DefaultTargetFramework; } } public TargetRuntime TargetRuntime { get { - DotNetProject prj = ParentItem as DotNetProject; - if (prj != null) + if (ParentItem is DotNetProject prj) return prj.TargetRuntime; - else - return Runtime.SystemAssemblyService.DefaultRuntime; + + return Runtime.SystemAssemblyService.DefaultRuntime; } } @@ -212,15 +193,13 @@ namespace MonoDevelop.Projects CompilationParameters = conf.compilationParameters != null ? conf.compilationParameters.Clone () : null; if (notifyParentItem) ParentItem?.NotifyModified ("CompilerParameters"); - signAssembly = conf.signAssembly; - delaySign = conf.delaySign; - assemblyKeyFile = conf.assemblyKeyFile; - } - - public new DotNetProject ParentItem { - get { return (DotNetProject) base.ParentItem; } + SignAssembly = conf.SignAssembly; + DelaySign = conf.DelaySign; + AssemblyKeyFile = conf.AssemblyKeyFile; } + public new DotNetProject ParentItem => (DotNetProject)base.ParentItem; + public virtual IEnumerable<string> GetDefineSymbols () { if (CompilationParameters != null) |