Deploying Script .exe with jpg causes error

This forum can be browsed by the general public. Posting is limited to current SAPIEN license holders with active maintenance and does not offer a response time guarantee.
Forum rules
DO NOT POST LICENSE NUMBERS, ACTIVATION KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
User avatar
Chris.Ediger
Posts: 29
Joined: Tue Oct 24, 2017 9:33 am

Deploying Script .exe with jpg causes error

Post by Chris.Ediger » Tue Oct 15, 2019 8:44 am

Product: PowerShell Studio 2019 (64 Bit)
Build: v5.6.167
OS: Windows 10 Enterprise (64 Bit)
Build: v10.0.17763.0

I have a tool I built that includes some html code that references a jpg file. After compiling and running the exe I get an Unhandled exception error
"Exception calling ".ctor" with "2" arguement(s). "Could not fin the file x:\myfilename.jpg"

How do I properly include a jpg in my package?

User avatar
brittneyr
Site Admin
Posts: 307
Joined: Thu Jun 01, 2017 7:20 am

Re: Deploying Script .exe with jpg causes error

Post by brittneyr » Tue Oct 15, 2019 11:48 am

There is no way to directly include this with your packaged script at the moment. Can you please provide more information such as your script?
If this is a file that is required and you plan to deploy your executable to locations, I would recommend creating an installer for your executable and include the jpeg file in the Files and Folders section.
Also, I would check the path of the jpeg to see if it exists first.
Brittney Ryn
SAPIEN Technologies, Inc.

User avatar
Chris.Ediger
Posts: 29
Joined: Tue Oct 24, 2017 9:33 am

Re: Deploying Script .exe with jpg causes error

Post by Chris.Ediger » Wed Oct 16, 2019 7:26 am

It is a tool that admins use to create AD user accounts. The script sends out an email to the new user and their manager. The email contains a jpg image of a thing they are supposed to do.
It looks like I solved the problem though by dropping the jpg into the script root. I tested it and it seems to be working. Thanks for the reply!