//----------------------------------------------------------------------- // // Copyright (c) Outercurve Foundation. All rights reserved. // //----------------------------------------------------------------------- namespace DotNetOpenAuth.BuildTasks { using System; using Microsoft.Build.Framework; using Microsoft.Build.Utilities; public class ReSignDelaySignedAssemblies : SnToolTask { /// /// Gets or sets the key file to use for signing. /// public ITaskItem KeyFile { get; set; } /// /// Gets or sets the key container. /// public ITaskItem KeyContainer { get; set; } /// /// Gets or sets the assemblies to re-sign. /// public ITaskItem[] Assemblies { get; set; } /// /// Generates the command line commands. /// protected override string GenerateCommandLineCommands() { ////if (this.Assemblies.Length != 1) { //// throw new NotSupportedException("Exactly 1 assembly for signing is supported."); ////} var args = new CommandLineBuilder(); args.AppendSwitch("-q"); if (this.KeyFile != null) { args.AppendSwitch("-R"); } else if (this.KeyContainer != null) { args.AppendSwitch("-Rc"); } else { throw new InvalidOperationException("Either KeyFile or KeyContainer must be set."); } args.AppendFileNameIfNotNull(this.Assemblies[0]); if (this.KeyFile != null) { args.AppendFileNameIfNotNull(this.KeyFile); } else { args.AppendFileNameIfNotNull(this.KeyContainer); } return args.ToString(); } } }