private static void Main(string[] args) { var targetPath = Path.GetDirectoryName(args[0]); var swixVars = args.Length == 1 ? null : GetArgs(args[1]); if (swixVars != null) { Console.WriteLine("Arguments found:"); foreach (var variable in swixVars) { Console.WriteLine($"{variable.Key}={variable.Value}"); } } SwixProcessor.Transform(args[0], SwixGuidMode.UseExistingAndUpdateStorage, targetPath, swixVars); }
public override bool Execute() { var result = new List <ITaskItem>(); foreach (var source in Sources) { try { Log.LogMessage(MessageImportance.Low, "Transforming {0}...", source); var variables = ParseVariablesDefinitions(); var varList = string.Concat(variables.Select(v => $"\n {v.Key} = {v.Value}")); Log.LogMessage(MessageImportance.Low, $"Swix variables parsed:{varList}"); var model = SwixProcessor.Transform(source.ItemSpec, (SwixGuidMode)Enum.Parse(typeof(SwixGuidMode), GuidMode), TargetDirectory, variables); ITaskItem ToItem(WixComponent c) { var r = new TaskItem(c.SourcePath); r.SetMetadata("Tag", c.OutputTag); return(r); } result.AddRange(model.Components.Where(c => !string.IsNullOrEmpty(c.OutputTag)).Select(ToItem)); } catch (SourceCodeException e) { var file = source.GetMetadata("FullPath"); var args = new BuildErrorEventArgs("SWIX", string.Empty, file, e.LineNumber, 0, e.LineNumber, 0, e.Message, string.Empty, string.Empty); BuildEngine.LogErrorEvent(args); return(false); } catch (Exception e) { Log.LogErrorFromException(e); return(false); } } Files = result.ToArray(); return(true); }