2

I'm working to make a Windows image (.wim) of Windows PE OS integrating MS .NET Framework in order to run a WinForm app operating as wizard for computer installation.

I have the exact same probleme as this post, on app execution from command line, it is not showed up any interface and does not display any error message. I also checked running process and there is no one for my application.

On image creation, as expressed on MS site I first imported WinPE-WMI requirement followed by .NET Framework package WinPE-NetFX. Next I created bootable USB stick using built image. I ended by copying the application on additional directory stored on USB.

Then I simply execute the application from command line.

Do you guys have any ideas ?

Thank in advance and best regards.

Jérémy

Daniel A. White
  • 187,200
  • 47
  • 362
  • 445
Naweap
  • 105
  • 8
  • Microsoft makes it very clear that only a very limited set of API is supported on WinPE, https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/winpe-create-apps#span-idsupportedapisinwindowspespanspan-idsupportedapisinwindowspespanspan-idsupportedapisinwindowspespansupported-apis-in-windows-pe while I assume Windows Forms requires much more than that. – Lex Li Jul 04 '18 at 22:59
  • Thanks for your answer, does it mean that WinForm is not supported on WinPE or do you think a dedicated API is available? Suppose that WinForm is not supported and there is no package available for it, what language could you recommend, other that HTA and VBS, in order to run GUI application within WinPE? – Naweap Jul 05 '18 at 06:26

2 Answers2

0

Try adding HTA and Scripting packages, it does increase the size of your boot.wim but the dependencies are required for certain libraries. Also check that you added the corresponding language packages as well. A tactic that I've used when I first did a .Net application in WinPE is add all the packages and test it in Virtual Box then slowly removed packages I didn't need a see if it worked. I made a batch script to to add all packages and REM out the ones I didn't need. Here's the script if needed

Dism /Mount-Image /ImageFile:"Z:\Tools\winpe_x86\media\sources\boot.wim" /index:1 /MountDir:"Z:\Tools\winpe_x86\mount"

Dism /Add-Package /Image:"Z:\Tools\winpe_x86\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\x86\WinPE_OCs\WinPE-HTA.cab" Dism /Add-Package /Image:"Z:\Tools\winpe_x86\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\x86\WinPE_OCs\en-us\WinPE-HTA_en-us.cab"

Dism /Add-Package /Image:"Z:\Tools\winpe_x86\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\x86\WinPE_OCs\WinPE-WMI.cab" Dism /Add-Package /Image:"Z:\Tools\winpe_x86\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\x86\WinPE_OCs\en-us\WinPE-WMI_en-us.cab"

Dism /Add-Package /Image:"Z:\Tools\winpe_x86\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\x86\WinPE_OCs\WinPE-MDAC.cab" Dism /Add-Package /Image:"Z:\Tools\winpe_x86\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\x86\WinPE_OCs\en-us\WinPE-MDAC_en-us.cab"

Dism /Add-Package /Image:"Z:\Tools\winpe_x86\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\x86\WinPE_OCs\WinPE-GamingPeripherals.cab"

Dism /Add-Package /Image:"Z:\Tools\winpe_x86\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\x86\WinPE_OCs\WinPE-Dot3Svc.cab" Dism /Add-Package /Image:"Z:\Tools\winpe_x86\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\x86\WinPE_OCs\en-us\WinPE-Dot3Svc_en-us.cab"

Dism /Add-Package /Image:"Z:\Tools\winpe_x86\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\x86\WinPE_OCs\WinPE-PPPoE.cab" Dism /Add-Package /Image:"Z:\Tools\winpe_x86\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\x86\WinPE_OCs\en-us\WinPE-PPPoE_en-us.cab"

Dism /Add-Package /Image:"Z:\Tools\winpe_x86\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\x86\WinPE_OCs\WinPE-RNDIS.cab" Dism /Add-Package /Image:"Z:\Tools\winpe_x86\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\x86\WinPE_OCs\en-us\WinPE-RNDIS_en-us.cab"

Dism /Add-Package /Image:"Z:\Tools\winpe_x86\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\x86\WinPE_OCs\WinPE-WDS-Tools.cab" Dism /Add-Package /Image:"Z:\Tools\winpe_x86\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\x86\WinPE_OCs\en-us\WinPE-WDS-Tools_en-us.cab"

Dism /Add-Package /Image:"Z:\Tools\winpe_x86\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\x86\WinPE_OCs\WinPE-Scripting.cab" Dism /Add-Package /Image:"Z:\Tools\winpe_x86\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\x86\WinPE_OCs\en-us\WinPE-Scripting_en-us.cab"

Dism /Add-Package /Image:"Z:\Tools\winpe_x86\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\x86\WinPE_OCs\WinPE-NetFx.cab" Dism /Add-Package /Image:"Z:\Tools\winpe_x86\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\x86\WinPE_OCs\en-us\WinPE-NetFx_en-us.cab"

Dism /Add-Package /Image:"Z:\Tools\winpe_x86\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\x86\WinPE_OCs\WinPE-PowerShell.cab" Dism /Add-Package /Image:"Z:\Tools\winpe_x86\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\x86\WinPE_OCs\en-us\WinPE-PowerShell_en-us.cab"

Dism /Add-Package /Image:"Z:\Tools\winpe_x86\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\x86\WinPE_OCs\WinPE-DismCmdlets.cab" Dism /Add-Package /Image:"Z:\Tools\winpe_x86\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\x86\WinPE_OCs\en-us\WinPE-DismCmdlets_en-us.cab"

Dism /Add-Package /Image:"Z:\Tools\winpe_x86\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\x86\WinPE_OCs\WinPE-SecureBootCmdlets.cab"

Dism /Add-Package /Image:"Z:\Tools\winpe_x86\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\x86\WinPE_OCs\WinPE-StorageWMI.cab" Dism /Add-Package /Image:"Z:\Tools\winpe_x86\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\x86\WinPE_OCs\en-us\WinPE-StorageWMI_en-us.cab" Dism /Unmount-Image /MountDir:"Z:\Tools\winpe_x86\mount" /commit

To test in virtual box use VMI for the drive, windows 7 and higher can mount VMI files using Diskpart or Disk Management.

John112358
  • 98
  • 10
0

I build a winpe with .net and a winform app...and I install the following .cabs, in order:

  • winpe-scripting
  • winpe-wmi
  • winpe-netfx
  • winpe-securestartup
  • winpe-enhancedstorage
  • winpe-dot3svc

I believe the only requirement for .net is winpe-netfx...but almost everybody doing winpe work needs wmi and scripting, too...just by the nature of what winpe is all about. The remaining .cabs are pretty specific to what I need.

Having said that, there's lots of stuff that doesn't work in winpe forms. "Standard" dialogs (File Open, etc) don't work, for example. It's kinda hit-n-miss. It's possible your main form asks for features not available in winpe.

So, start basic and build up...a form /w single button...get that to deploy...then add things until it breaks. Don't expect to build a sophisticated UI in winpe...it's not gonna let you. Labels, buttons, text boxes, list boxes...and not much more.

Also - be aware that there are deployments for x86 and amd64 (you probably want amd64)...and you have to match the .cabs to the image you start with...and compile your .net program to be either any .cpu or specific to your chosen runtime. If you choose any cpu, turn off "prefer 32 bit" on the build tab.

The build of a winpe image is tedious and error-prone. Make sure you're getting all of your dependencies in the running image.

Clay
  • 4,999
  • 1
  • 28
  • 45