C# App cannot read Excel file when ran using Octopus


So I built a program in C# that references data in a spreadsheet and automates websites with that data. Running this program in Visual Studio and with Powershell on its local machine works like a charm. However, whenever I try to run the program using Octopus, it crashes with this error:

Step 2: Run Package
September 13th 2017 11:18:11Fatal
The step failed: Activity Run Package on Master-Controller failed with error ‘The remote script failed with exit code 255’.
September 13th 2017 11:17:57Info
Executing script on 'Master-Controller’
September 13th 2017 11:18:03Error
Unhandled Exception: System.Runtime.InteropServices.COMException: ‘PIM_Master_Data.xlsx’ could not be found. Check the spelling of the file name, and verify that the file location is correct.
September 13th 2017 11:18:03Error
If you are trying to open the file from your list of most recently used files, make sure that the file has not been renamed, moved, or deleted.
September 13th 2017 11:18:03Error
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)
September 13th 2017 11:18:03Error
at se_builder.PIM_Bicycle.Main(String[] args) in C:\Repository\QA - Automation\UnitTestProject\PIM_Bicycle.cs:line 29
September 13th 2017 11:18:11Fatal
The remote script failed with exit code 255
September 13th 2017 11:18:11Fatal
Run Package on Master-Controller

Thanks for the help in advance!

Alright I resolved fixed this issue. Due to inexperience with Octopus-Deploy I didn’t know that I couldn’t reference files on the local machine that the Tentacle was installed on (unless you can and I can’t find it anywhere). So to resolve this problem I just made sure that the spreadsheet I was using was included in the NuGet package sent from VSTS. When doing this, be sure to unzip your file with the Unzip step and you’’ be good to go.

Hi Zach,

Thanks for getting in touch, and I’m glad to hear that you worked around your issue!

You are able to reference files on the local machine, so it may just be how you have set up the script task and where it is executing from? If you would like further assistance on this please let me know.

Happy deploying!