Esempio n. 1
0
        public override bool Execute()
        {
            try
            {
                _log.Debug("Running CleanExcelAddIn MSBuild Task");

                LogDiagnostics();

                FilesInProject = FilesInProject ?? new ITaskItem[0];
                _log.Debug("Number of files in project: " + FilesInProject.Length);

                _common = new BuildTaskCommon(FilesInProject, OutDirectory, FileSuffix32Bit, FileSuffix64Bit, ProjectName, AddInFileName);

                var existingBuiltFiles = _common.GetBuildItemsForDnaFiles();
                _packedFilesToDelete = GetPackedFilesToDelete(existingBuiltFiles);

                // Get the packed name versions : Refactor this + build items
                DeleteAddInFiles(existingBuiltFiles);
                DeletePackedAddInFiles(_packedFilesToDelete);

                return(true);
            }
            catch (Exception ex)
            {
                _log.Error(ex, ex.Message);
                _log.Error(ex, ex.ToString());
                return(false);
            }
        }
Esempio n. 2
0
        public override bool Execute()
        {
            try
            {
                LogDiagnostics();

                FilesInProject = FilesInProject ?? new ITaskItem[0];
                LogMessage("Number of files in project: " + FilesInProject.Length, MessageImportance.Low);

                _common = new BuildTaskCommon(FilesInProject, OutDirectory, FileSuffix32Bit, FileSuffix64Bit);

                var existingBuiltFiles = _common.GetBuildItemsForDnaFiles();
                _packedFilesToDelete = GetPackedFilesToDelete(existingBuiltFiles);

                LogMessage("---");

                // Get the packed name versions : Refactor this + build items
                DeleteAddInFiles(existingBuiltFiles);
                DeletePackedAddInFiles(_packedFilesToDelete);

                return(true);
            }
            catch (Exception ex)
            {
                LogError("DNA" + ex.GetType().Name.GetHashCode(), ex.Message);
                LogError("DNA" + ex.GetType().Name.GetHashCode(), ex.ToString());
                return(false);
            }
        }
Esempio n. 3
0
        private bool TryGetExcelAddInForDebugging(string excelExePath, out string addinForDebugging)
        {
            addinForDebugging = null;

            Bitness excelBitness;

            if (!_excelDetector.TryFindExcelBitness(excelExePath, out excelBitness))
            {
                return(false);
            }

            _common = new BuildTaskCommon(FilesInProject, OutDirectory, FileSuffix32Bit, FileSuffix64Bit);

            var outputBuildItems = _common.GetBuildItemsForDnaFiles();

            var firstAddIn = outputBuildItems.FirstOrDefault();

            if (firstAddIn == null)
            {
                return(false);
            }

            switch (excelBitness)
            {
            case Bitness.Bit32:
            {
                addinForDebugging = firstAddIn.OutputXllFileNameAs32Bit;
                return(true);
            }

            case Bitness.Bit64:
            {
                addinForDebugging = firstAddIn.OutputXllFileNameAs64Bit;
                return(true);
            }

            default:
            {
                return(false);
            }
            }
        }
Esempio n. 4
0
        public override bool Execute()
        {
            try
            {
                LogDebugMessage("Running CreateExcelAddIn MSBuild Task");

                LogDiagnostics();

                RunSanityChecks();

                _dnaFilesToPack = new List <ITaskItem>();
                DnaFilesToPack  = new ITaskItem[0];

                FilesInProject = FilesInProject ?? new ITaskItem[0];
                LogDebugMessage("Number of files in project: " + FilesInProject.Length);

                _configFilesInProject = GetConfigFilesInProject();
                _common = new BuildTaskCommon(FilesInProject, OutDirectory, FileSuffix32Bit, FileSuffix64Bit);

                var buildItemsForDnaFiles = _common.GetBuildItemsForDnaFiles();

                TryBuildAddInFor32Bit(buildItemsForDnaFiles);

                LogMessage("---", MessageImportance.High);

                TryBuildAddInFor64Bit(buildItemsForDnaFiles);

                DnaFilesToPack = _dnaFilesToPack.ToArray();

                return(true);
            }
            catch (Exception ex)
            {
                LogError("DNA" + ex.GetType().Name.GetHashCode(), ex.Message);
                LogError("DNA" + ex.GetType().Name.GetHashCode(), ex.ToString());
                return(false);
            }
        }