I'm making a Winforms Application in Powershell that has 3 different forms and want to compile it into an .exe with ps2exe. I've used -iconFile
for the icon but I'm running into a problem that only the 1st form uses the icon. The 2nd form opens once you press a button in the 1st form but it's using the standard .net winforms icon instead of the icon specified with ps2exe.
Is there any way I can assign the icon to all forms with ps2exe or a different tool? Maybe even in the script itself?
CodePudding user response:
As suggested in the comments, you might just embed your icons in the PowerShell script as follows:
- Load your icon as byte stream:
$Icon = Get-Content .\favicon.ico -AsByteStream
Or, (as for this example,) I am using the (fav)icon from this StackOverflow site:
$Response = Invoke-WebRequest https://cdn.sstatic.net/Sites/stackoverflow/Img/favicon.ico?v=ec617d715196
$Icon = $Response.Content