Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

c# - .NET GUI Not Displaying in WinPE

I have created a utility in C#, something basic. I have it running during an SCCM task sequence deployment. One of the first things it does (during the form load event) is query ldap. That portion of code is in a try block and an exception is caught and the error message displays, but the form never shows up. On my dev machine when there was an error I would get the message but the form would display afterward.

I have verified that all the dll's I'm calling are installed on the WinPE, has anyone done any .NET development for WinPE yet? This is WinPE 4.0 and I have installed .NET 4.0 and other software using the dism tool that comes with the Windows 8 ADK. Nothing much on the net yet since .NET support in WinPE is fairly new.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

It appears that the System.Windows.Forms assembly wasn't loaded. I found this out by trying to create a form with powershell, and powershell gave an error that said it couldn't find the type. After googling, I came across a fix that said to use [System.Reflection.Assembly]::LoadWithPartialName method to load the assembly, and I loaded the System.Windows.Forms assembly. After that, I created a form in powershell and it displayed without a problem, and after I ran my app again it displayed the gui fine.

UPDATE

Looks like I've found my answer: The task sequence runs in session 0, i.e., no gui! http://blogs.technet.com/b/cameronk/archive/2010/04/27/creating-a-user-interactive-task-sequence-experience.aspx

Update 20130219

I wound up using psexec and calling my executable from it, using

psexec.exe -accepteula -s -i -h C:\_SMSTaskSequencePackagesSTE000AAAmyapp.exe

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...