Embed file when merging to executable

VSCode
net462
Windows Powershell

Hi,

I am having some difficulties attempting to reference an included resource file.

Resources = [string[]]@('Rules.txt') # Resources to embed in the output executable

I can expand the compiled .exe file and I do see the contents of this file included in the .text file, so I know the file is being included. :slight_smile:

However, I can’t seem to figure out how to reference the contents of that file from the powershell script.
Is there a special variable name I would reference the content of that file with?

$Resources[0]

Any help would be forever appreciated!

Any suggestions?

Hi @kennymick ,

I updated to documentation with an example here: Package.psd1 - PowerShell Pro Tools

Works like a champ!

A couple of small minor notes to anyone else trying to do this.

  1. It seems that the resource files must be located in the same directory as your script
  2. The resource files cannot have any spaces in the name
  3. If running the script uncompiled, you will get some errors. I am not sure if there is a better way to handle this, but I just dropped a try/catch block and it handled it very nicely.
1 Like