Rockb
Rockb

Reputation: 43

How can I get an application to run in WinPE?

Trying to get a simple Windows Forms vb.net app to run in WInPE. Nothing compilated just read a text file, prompt the user for some input, create a text file (batch file) then run the batch file.

I have added the .net package to the Wim

set PF=C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\x86\WinPE_OCs\
dism /Add-Package /Image:"f:\WimMount\WIM" /PackagePath:"%PF%WinPE-WMI.cab"
dism /Add-Package /Image:"f:\WimMount\WIM" /PackagePath:"%PF%en-us\WinPE-WMI_en-us.cab"
dism /Add-Package /Image:"f:\WimMount\WIM" /PackagePath:"%PF%WinPE-NetFx.cab"
dism /Add-Package /Image:"f:\WimMount\WIM" /PackagePath:"%PF%en-us\WinPE-NetFx_en-us.cab"

If I use a 64Bit WinPE nothing happens when I call the .exe. If I use a 32bit WinPE the following is returned: xxxx is not compatible with the version of windows you are running

I have tried compiling as any CPU, Any CPU with Prefer32-Bit Checked, x86, and x64.

I have even tried a VB6 app that did not work. I know I did this with VB6 many years ago and have read that all that was required was to add the packages to the PE environment but can't seem to get it to work.

Upvotes: 2

Views: 2506

Answers (2)

JustMe
JustMe

Reputation: 1

You are using the wrong packages for x64.

set PF=C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\x86\WinPE_OCs\

You are using 'x86\WinPE_OCs' but you should use: 'amd64\WinPE_OCs' as stated in: https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/winpe-add-packages--optional-components-reference?view=windows-11

Upvotes: 0

Clay
Clay

Reputation: 5084

Your adds look different than mine. I'm running a c# windows forms app in my project, so I know it's at least possible. Make sure you don't use things in your app that arent's supported in the minimal .net support. A big, surprising part that you can't use is the standard file dialogs. That may have been the source of your near-but-not-quite success w/ your 32bit experiment.

Here's what I put in. You can see the shape of the adds are a little different:

cd /d "%adk%\Windows Preinstallation Environment\amd64\WinPE_OCs"
dism /image:C:\Mount /add-package /packagepath:"WinPE-Scripting.cab" /packagepath:"en-us\WinPE-Scripting_en-us.cab"
dism /image:C:\Mount /add-package /packagepath:"WinPE-WMI.cab" /packagepath:"en-us\WinPE-WMI_en-us.cab"
dism /image:C:\Mount /add-package /packagepath:"WinPE-NetFx.cab" /packagepath:"en-us\WinPE-NetFx_en-us.cab"
dism /image:C:\Mount /add-package /packagepath:"WinPE-SecureStartup.cab" /packagepath:"en-us\WinPE-SecureStartup_en-us.cab"
dism /image:C:\Mount /add-package /packagepath:"WinPE-EnhancedStorage.cab" /packagepath:"en-us\WinPE-EnhancedStorage_en-us.cab"
dism /image:C:\Mount /add-package /packagepath:"WinPE-Dot3Svc.cab" /packagepath:"en-us\WinPE-Dot3Svc_en-us.cab"
dism /unmount-wim /commit /mountdir:c:\mount

As you can deduce from the first line shown, this is a x64 winpe...and we just compile to any cpu.

Upvotes: 1

Related Questions