Compile Powershell Wizard Host

Jul 1, 2016 at 4:15 PM
I don't know, if anyone is still around here, but:


So, I wanted to change some string on the wizard, change the icon, stuff like that, to make it a bit more polished for my use, but I ran into a problem with the compilation.

It actually compiled fine (with VS2015), and I could run the PS2Wiz.ps1 file on my script and in produced an executable. But when I tried to run the exe, I got an NullPointer exception:
************** Exception Text **************
System.NullReferenceException: Object reference not set to an instance of an object.
   at PowerShell_Wizard_Host.PSWizHost.PSWizHost_FormClosing(Object sender, FormClosingEventArgs e)
   at System.Windows.Forms.Form.OnFormClosing(FormClosingEventArgs e)
   at System.Windows.Forms.Form.WmClose(Message& m)
   at System.Windows.Forms.Form.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
VS also warned about PowershellHostControl1 not being used for anything, and that it's value would never change.

Anybody got any ideas?
Jul 5, 2016 at 12:07 PM
Okay.. So..
Disregard the question above. I was trying to compile / build the solution from VS after editing the code I needed to. But there is no meaning in doing that. The PS2Wiz.ps1 script builds an executable, based on the script you provide it. The solution itself is not meant to be compiled without a script provided to it.

So if anybody needs to edit something, just edit the .cs file (can be done in VS), but do not compile / build the project in VS afterwards. Just save your changes, and run the PS2Wiz.ps1 script as usual, and the outputted Powershell Host Wizard.exe will contain your changes.