Cannot find resource files after publishing dashboard

Hey guys,

I’m developing a dashboard that uses multiple files as resources:

config.psd1 (config file for the dashboard Import-PowerShellDataFile -Path ".\Config.psd1")
servers.csv (data file with server information Import-Csv -Path ".\servers.csv")
CustomModule.ps1 (a custom powershell file with utils functions Import-Module .\CustomModule.ps1 -Force )

The main file (dashboard.ps1) imports the 3 other files in order to execute correctly.
This works fine when I’m developing the dashboard, however, when I publish the dashboard to run as a windows service, the service fails to start because it cannot find the files imported.

I’ve tried using absolute and relative (to the dashboard.ps1) paths and neither one works.

How should I handle imported files?
Am I doing something wrong? I think this should be straight-forward.

Thanks in advance

Check the files’ security. Maybe the account the service is running under does not have access to the files.