1
votes

I'm trying to execute an exe by passing some arguments using Command line task in DevOps pipeline. The exe is used for reading an excel file using Microsoft.Office.Interop.Excel.

The pipeline is configured to use a self hosted agent. Office is installed in agent machine and exe is working fine there. Tried to execute the same commands that are used in command line task on agent machine and its worked without any exception.

Agent service on agent machine is configured to run as a service and using administrator account.

While running the build, in command line task below exception is logged,

    Unhandled Exception: System.Runtime.InteropServices.COMException: Exception from HRESULT: 0x800A03EC
   at Microsoft.Office.Interop.Excel.Workbooks.Open(String Filename, Object UpdateLinks, Object ReadOnly, Object Format, Object Password, Object WriteResPassword, Object IgnoreReadOnlyRecommended, Object Origin, Object Delimiter, Object Editable, Object Notify, Object Converter, Object AddToMru, Object Local, Object CorruptLoad)
   at Xerox.DM.SQLIntegration.ExcelHelper.GetExcelWorksheet_v1(String fileName, String sheetName, Application excelApp, Workbook workbook)
   at Xerox.DM.SQLIntegration.ExcelToSql.GenerateInsertSqlCode(String fileName, String sheetName, Application excelApp)
   at Xerox.DM.SQLIntegration.SimpleLogic.RunSilentMode(String[] args)
   at Xerox.DM.SQLIntegration.Program.Main(String[] args)

Same user account( Administrator account) is used for both agent service and RDP connection. command executed successfully by taking RDP, but exception thrown while running build. What should be the reason?

1

1 Answers

0
votes

I found a solution for this issue. It was an access permission issue. Even though I have configured build agent to run under administrator account, a separate user group is created with this user account

enter image description here

And this group doesn't have Access Permission to to Microsoft Excel Application Component Service. Setting permission as in the below screenshot will solve this issue.

enter image description here