From 55ef8594238bf56b25dfa801401d81dc8e001c1c Mon Sep 17 00:00:00 2001 From: David Fowler Date: Sat, 17 Oct 2015 03:32:58 -0700 Subject: [PATCH] Add support for more compilation options - Added keyFile - Added delaySign - Added pdb generation --- .../Program.cs | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/Microsoft.DotNet.Tools.Compiler/Program.cs b/src/Microsoft.DotNet.Tools.Compiler/Program.cs index 3e32fdf96..d246f8eca 100644 --- a/src/Microsoft.DotNet.Tools.Compiler/Program.cs +++ b/src/Microsoft.DotNet.Tools.Compiler/Program.cs @@ -171,24 +171,45 @@ namespace Microsoft.DotNet.Tools.Compiler private static void ApplyCompilationOptions(CompilerOptions compilationOptions, List cscArgs) { var targetType = compilationOptions.EmitEntryPoint.GetValueOrDefault() ? "exe" : "library"; + cscArgs.Add($"-target:{targetType}"); + if (compilationOptions.AllowUnsafe.GetValueOrDefault()) { cscArgs.Add("-unsafe+"); } + cscArgs.AddRange(compilationOptions.Defines.Select(d => $"-d:{d}")); + if (compilationOptions.Optimize.GetValueOrDefault()) { cscArgs.Add("-optimize"); } + if (!string.IsNullOrEmpty(compilationOptions.Platform)) { cscArgs.Add($"-platform:{compilationOptions.Platform}"); } + if (compilationOptions.WarningsAsErrors.GetValueOrDefault()) { cscArgs.Add("-warnaserror"); } + + if (compilationOptions.DelaySign.GetValueOrDefault()) + { + cscArgs.Add("-delaysign+"); + } + + if (!string.IsNullOrEmpty(compilationOptions.KeyFile)) + { + cscArgs.Add($"-keyFile:\"{compilationOptions.KeyFile}\""); + } + + // TODO: Support debug portable + cscArgs.Add("-debug:full"); + + // TODO: OSS signing } private static void ShowDependencyInfo(IEnumerable dependencies)