public override bool Execute() { try { _log.Debug("Running SetDebuggerOptions MSBuild Task"); // Create instances of ExcelDetector and ExcelDnaProject _excelDetector = _excelDetectorLazy.Value; _project = _projectLazy.Value; FilesInProject = FilesInProject ?? new ITaskItem[0]; _log.Debug("Number of files in project: " + FilesInProject.Length); var excelExePath = GetExcelPath(); var addInForDebugging = GetAddInForDebugging(excelExePath); LogDiagnostics(); if (!_project.TrySetDebuggerOptions(ProjectName, excelExePath, addInForDebugging)) { const string message = "Unable to set the debugger options within Visual Studio. " + "Please restart Visual Studio and try again."; _log.Warning("DNA" + "PROJECT".GetHashCode(), message); } } catch (Exception ex) { _log.Warning(ex, ex.Message); } // Setting the debugger options is not essential to the build process, thus if anything // goes wrong, we'll report errors and warnings, but will not fail the build because of that return(true); }
internal SetDebuggerOptions(IBuildLogger log, IExcelDetector excelDetector, IExcelDnaProject project) { if (excelDetector == null) { throw new ArgumentNullException(nameof(excelDetector)); } if (project == null) { throw new ArgumentNullException(nameof(project)); } _log = log ?? throw new ArgumentNullException(nameof(log)); _excelDetectorLazy = new Lazy <IExcelDetector>(() => excelDetector); _projectLazy = new Lazy <IExcelDnaProject>(() => project); }
public SetDebuggerOptions(IExcelDetector excelDetector, IExcelDnaProject dte) : base("ExcelDnaSetDebuggerOptions") { if (excelDetector == null) { throw new ArgumentNullException("excelDetector"); } if (dte == null) { throw new ArgumentNullException("dte"); } _excelDetector = excelDetector; _dte = dte; }
public SetDebuggerOptions(IBuildLogger log, IExcelDetector excelDetector, IExcelDnaProject dte) { _log = log ?? throw new ArgumentNullException(nameof(log)); _excelDetector = excelDetector ?? throw new ArgumentNullException(nameof(excelDetector)); _dte = dte ?? throw new ArgumentNullException(nameof(dte)); }
public SetDebuggerOptions() { _log = new BuildLogger(this, "ExcelDnaSetDebuggerOptions"); _excelDetector = new ExcelDetector(); _dte = new ExcelDnaProject(_log); }