Powershell 7.3 Package not showing GUI

Tool: Visual Studio Code, PSScriptPad, PowerShell 7.3
Version: Extension v2023.3.0

Hello all,

I have a Script wit a dot sourced designer.ps1 file. Basically what is defined in the Design are a few Checkboxes and based on what I select it will install some Software when OK is Clicked.
This works fine when Packaging as exe using Windows Powershell 5.1. Powershell 7.2 also seems to open fine, it shows the GUI and everything works.
But when I Package using Powershell 7.3 and .net7.0 in the Package.psd1 file, it packages into the exe without errors. But when I open the executable, it shows and immediately closes the program within a split second. I sometimes see it Flashing, but sometimes it’s to quick to notice.

In the Windows Event Viewer Log, I see the following records directly after the executable closed.

Applicstrong textation: Installaties_gui_2023.exe
CoreCLR Version: 7.0.423.11508
.NET Version: 7.0.4
Description: The process was terminated due to an unhandled exception.
Exception Info: System.TypeInitializationException: The type initializer for ‘System.Management.Automation.PSObject’ threw an exception.
—> System.IO.FileNotFoundException:
File name: ‘Microsoft.Management.Infrastructure, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35’
at System.Management.Automation.PSObject…cctor()
— End of inner exception stack trace —
at System.Management.Automation.PSObject.get_Properties()
at System.Management.Automation.HostUtilities.GetDollarProfile(String allUsersAllHosts, String allUsersCurrentHost, String currentUserAllHosts, String currentUserCurrentHost)
at Microsoft.PowerShell.ConsoleHost.DoRunspaceInitialization(RunspaceCreationEventArgs args)
at Microsoft.PowerShell.ConsoleHost.DoCreateRunspace(RunspaceCreationEventArgs args)
at Microsoft.PowerShell.ConsoleHost.CreateRunspace(RunspaceCreationEventArgs runspaceCreationArgs)
at Microsoft.PowerShell.ConsoleHost.DoRunspaceLoop(String initialCommand, Boolean skipProfiles, Collection`1 initialCommandArgs, Boolean staMode, String configurationName, String configurationFilePath)
at Microsoft.PowerShell.ConsoleHost.Run(CommandLineParameterParser cpp, Boolean isPrestartWarned)
at Microsoft.PowerShell.ConsoleHost.Start(String bannerText, String helpText, Boolean issProvidedExternally)
at Microsoft.PowerShell.ConsoleShell.StartImpl(InitialSessionState initialSessionState, String bannerText, String helpText, String args, Boolean issProvided)
at Microsoft.PowerShell.ConsoleShell.Start(String bannerText, String helpText, String args)
at PowerShellToolsPro.Packager.ConsoleHost.Program.Main(String args)

Does somebody have a clue what is going on? Or any suggestions?

Below is a Picture of my Package.psd1 file in case it helps :slight_smile:

Thanks in advance.