Windows PE WinForm应用程序未执行

时间:2018-07-04 14:17:40

标签: c# .net winpe

我正在制作一个集成了MS .NET Framework的Windows PE OS的Windows映像(.wim),以便运行作为计算机安装向导的WinForm应用程序。

我与this post有完全相同的问题,从命令行执行应用程序时,它没有显示任何界面,也没有显示任何错误消息。我还检查了运行过程,没有适合我的应用程序。

在创建图像时,如MS site所示,我首先导入了 WinPE-WMI 要求,然后导入了.NET Framework软件包 WinPE-NetFX 。接下来,我使用内置映像创建了可启动USB记忆棒。最后,我将应用程序复制到USB上存储的其他目录中。

然后我只需从命令行执行应用程序即可。

你们有什么想法吗?

先谢谢您,并致以最诚挚的问候。

杰里米

2 个答案:

答案 0 :(得分:0)

尝试添加HTA和脚本包,它确实会增加boot.wim的大小,但是某些库需要依赖项。还要检查是否还添加了相应的语言包。我最初在WinPE中执行.Net应用程序时使用的策略是添加所有程序包,然后在Virtual Box中对其进行测试,然后慢慢删除那些我不需要查看其是否有效的程序包。我制作了一个批处理脚本以添加所有程序包,并删除不需要的程序包。这是需要的脚本

Dism /安装映像/ImageFile:"Z:\Tools\winpe_x86\media\sources\boot.wim“ / index:1 / MountDir:” Z:\ Tools \ winpe_x86 \ mount“

Dism /添加软件包/图像:“ Z:\ Tools \ winpe_x86 \ mount” / PackagePath:“ C:\ Program Files(x86)\ Windows Kits \ 10 \ Asssmentment and Deployment Kit \ Windows预安装环境\ x86 \ WinPE_OCs \ WinPE-HTA.cab“ Dism / Add-Package / Image:“ Z:\ Tools \ winpe_x86 \ mount” / PackagePath:“ C:\ Program Files(x86)\ Windows Kits \ 10 \ Asssmentment and Deployment Kit \ Windows预安装环境\ x86 \ WinPE_OCs \ en -us \ WinPE-HTA_zh-cn.cab“

Dism /添加软件包/图像:“ Z:\ Tools \ winpe_x86 \ mount” / PackagePath:“ C:\ Program Files(x86)\ Windows Kits \ 10 \ Asssmentment and Deployment Kit \ Windows预安装环境\ x86 \ WinPE_OCs \ WinPE-WMI.cab“ Dism / Add-Package / Image:“ Z:\ Tools \ winpe_x86 \ mount” / PackagePath:“ C:\ Program Files(x86)\ Windows Kits \ 10 \ Asssmentment and Deployment Kit \ Windows预安装环境\ x86 \ WinPE_OCs \ en -us \ WinPE-WMI_zh-cn.cab“

Dism /添加软件包/图像:“ Z:\ Tools \ winpe_x86 \ mount” / PackagePath:“ C:\ Program Files(x86)\ Windows Kits \ 10 \ Asssmentment and Deployment Kit \ Windows预安装环境\ x86 \ WinPE_OCs \ WinPE-MDAC.cab“ Dism / Add-Package / Image:“ Z:\ Tools \ winpe_x86 \ mount” / PackagePath:“ C:\ Program Files(x86)\ Windows Kits \ 10 \ Asssmentment and Deployment Kit \ Windows预安装环境\ x86 \ WinPE_OCs \ en -us \ WinPE-MDAC_zh-cn.cab“

Dism /添加软件包/图像:“ Z:\ Tools \ winpe_x86 \ mount” / PackagePath:“ C:\ Program Files(x86)\ Windows Kits \ 10 \ Asssmentment and Deployment Kit \ Windows预安装环境\ x86 \ WinPE_OCs \ WinPE-GamingPeripherals.cab“

Dism /添加软件包/图像:“ Z:\ Tools \ winpe_x86 \ mount” / PackagePath:“ C:\ Program Files(x86)\ Windows Kits \ 10 \ Asssmentment and Deployment Kit \ Windows预安装环境\ x86 \ WinPE_OCs \ WinPE-Dot3Svc.cab“ Dism / Add-Package / Image:“ Z:\ Tools \ winpe_x86 \ mount” / PackagePath:“ C:\ Program Files(x86)\ Windows Kits \ 10 \ Asssmentment and Deployment Kit \ Windows预安装环境\ x86 \ WinPE_OCs \ en -us \ WinPE-Dot3Svc_zh-cn.cab“

Dism /添加软件包/图像:“ Z:\ Tools \ winpe_x86 \ mount” / PackagePath:“ C:\ Program Files(x86)\ Windows Kits \ 10 \ Asssmentment and Deployment Kit \ Windows预安装环境\ x86 \ WinPE_OCs \ WinPE-PPPoE.cab“ Dism / Add-Package / Image:“ Z:\ Tools \ winpe_x86 \ mount” / PackagePath:“ C:\ Program Files(x86)\ Windows Kits \ 10 \ Asssmentment and Deployment Kit \ Windows预安装环境\ x86 \ WinPE_OCs \ en -us \ WinPE-PPPoE_zh-cn.cab“

Dism /添加软件包/图像:“ Z:\ Tools \ winpe_x86 \ mount” / PackagePath:“ C:\ Program Files(x86)\ Windows Kits \ 10 \ Asssmentment and Deployment Kit \ Windows预安装环境\ x86 \ WinPE_OCs \ WinPE-RNDIS.cab“ Dism / Add-Package / Image:“ Z:\ Tools \ winpe_x86 \ mount” / PackagePath:“ C:\ Program Files(x86)\ Windows Kits \ 10 \ Asssmentment and Deployment Kit \ Windows预安装环境\ x86 \ WinPE_OCs \ en -us \ WinPE-RNDIS_zh-cn.cab“

Dism /添加软件包/图像:“ Z:\ Tools \ winpe_x86 \ mount” / PackagePath:“ C:\ Program Files(x86)\ Windows Kits \ 10 \ Asssmentment and Deployment Kit \ Windows预安装环境\ x86 \ WinPE_OCs \ WinPE-WDS-Tools.cab“ Dism / Add-Package / Image:“ Z:\ Tools \ winpe_x86 \ mount” / PackagePath:“ C:\ Program Files(x86)\ Windows Kits \ 10 \ Asssmentment and Deployment Kit \ Windows预安装环境\ x86 \ WinPE_OCs \ en -us \ WinPE-WDS-Tools_zh-cn.cab“

Dism /添加软件包/图像:“ Z:\ Tools \ winpe_x86 \ mount” / PackagePath:“ C:\ Program Files(x86)\ Windows Kits \ 10 \ Asssmentment and Deployment Kit \ Windows预安装环境\ x86 \ WinPE_OCs \ WinPE-Scripting.cab“ Dism / Add-Package / Image:“ Z:\ Tools \ winpe_x86 \ mount” / PackagePath:“ C:\ Program Files(x86)\ Windows Kits \ 10 \ Asssmentment and Deployment Kit \ Windows预安装环境\ x86 \ WinPE_OCs \ en -us \ WinPE-Scripting_zh-cn.cab“

Dism /添加软件包/图像:“ Z:\ Tools \ winpe_x86 \ mount” / PackagePath:“ C:\ Program Files(x86)\ Windows Kits \ 10 \ Asssmentment and Deployment Kit \ Windows预安装环境\ x86 \ WinPE_OCs \ WinPE-NetFx.cab“ Dism / Add-Package / Image:“ Z:\ Tools \ winpe_x86 \ mount” / PackagePath:“ C:\ Program Files(x86)\ Windows Kits \ 10 \ Asssmentment and Deployment Kit \ Windows预安装环境\ x86 \ WinPE_OCs \ en -us \ WinPE-NetFx_en-us.cab“

Dism /添加软件包/图像:“ Z:\ Tools \ winpe_x86 \ mount” / PackagePath:“ C:\ Program Files(x86)\ Windows Kits \ 10 \ Asssmentment and Deployment Kit \ Windows预安装环境\ x86 \ WinPE_OCs \ WinPE-PowerShell.cab“ Dism / Add-Package / Image:“ Z:\ Tools \ winpe_x86 \ mount” / PackagePath:“ C:\ Program Files(x86)\ Windows Kits \ 10 \ Asssmentment and Deployment Kit \ Windows预安装环境\ x86 \ WinPE_OCs \ en -us \ WinPE-PowerShell_zh-cn.cab“

Dism /添加软件包/图像:“ Z:\ Tools \ winpe_x86 \ mount” / PackagePath:“ C:\ Program Files(x86)\ Windows Kits \ 10 \ Asssmentment and Deployment Kit \ Windows预安装环境\ x86 \ WinPE_OCs \ WinPE-DismCmdlets.cab“ Dism / Add-Package / Image:“ Z:\ Tools \ winpe_x86 \ mount” / PackagePath:“ C:\ Program Files(x86)\ Windows Kits \ 10 \ Asssmentment and Deployment Kit \ Windows预安装环境\ x86 \ WinPE_OCs \ en -us \ WinPE-DismCmdlets_zh-cn.cab“

Dism /添加软件包/图像:“ Z:\ Tools \ winpe_x86 \ mount” / PackagePath:“ C:\ Program Files(x86)\ Windows Kits \ 10 \ Asssmentment and Deployment Kit \ Windows预安装环境\ x86 \ WinPE_OCs \ WinPE-SecureBootCmdlets.cab“

Dism /添加软件包/图像:“ Z:\ Tools \ winpe_x86 \ mount” / PackagePath:“ C:\ Program Files(x86)\ Windows Kits \ 10 \ Asssmentment and Deployment Kit \ Windows预安装环境\ x86 \ WinPE_OCs \ WinPE-StorageWMI.cab“ Dism / Add-Package / Image:“ Z:\ Tools \ winpe_x86 \ mount” / PackagePath:“ C:\ Program Files(x86)\ Windows Kits \ 10 \ Asssmentment and Deployment Kit \ Windows预安装环境\ x86 \ WinPE_OCs \ en -us \ WinPE-StorageWMI_zh-cn.cab“ Dism / Unmount-Image / MountDir:“ Z:\ Tools \ winpe_x86 \ mount” / commit

要在虚拟盒中进行测试,请使用VMI作为驱动器,Windows 7及更高版本可以使用Diskpart或Disk Management挂载VMI文件。

答案 1 :(得分:0)

我用.net和winform应用程序构建一个winpe ...并按顺序安装以下.cabs:

  • winpe脚本
  • winpe-wmi
  • winpe-netfx
  • winpe-securestartup
  • winpe-enhancedstorage
  • winpe-dot3svc

我认为对.net的唯一要求是winpe-netfx ...但是几乎每个从事winpe工作的人也都需要wmi和脚本...只是就winpe的本质而言。其余的.cabs完全符合我的需求。

话虽这么说,但很多东西都不会以Winpe形式工作。例如,“标准”对话框(文件打开等)不起作用。有点错过。您的主表单可能会询问winpe中不可用的功能。

因此,从基础开始并建立...一个带有单个按钮的表单/ w ...使其部署...然后添加东西直到它破裂。不要指望在winpe中构建复杂的UI ...这不会让你失望的。标签,按钮,文本框,列表框...等等。

另外,请注意,有针对x86和amd64的部署(您可能需要amd64)...并且您必须将.cabs与开始的映像进行匹配...,然后将.net程序编译为任何.cpu或特定于您选择的运行时。如果您选择任何CPU,请在“构建”标签上关闭“首选32位”。

winpe图像的构建很繁琐且容易出错。确保在运行映像中获取所有依赖项。