microsoft/Microsoft-Win32-Content-Prep-Tool

[Bug] - Call from .Net/C# code fail when Windows Terminal is set to "Default terminal application = Windows Terminal" - works fine if set to "Default terminal application = Windows Console Host" - Windows 11 22621.963, Windows Terminal 1.15.3466.0

michaelmsonne opened this issue · 5 comments

This is a bug, as I had tested my tool on a Windows Server 2016 where it runs fine.

When I call the tool from .Net/C# code it fail when Windows Terminal is set to "Default terminal application = Windows Terminal" - and it works fine if set to "Default terminal application = Windows Console Host".

Im running:
Windows 11 22621.963
Windows Terminal 1.15.3466.0

Code 1:
var tool = appPath + @"\IntuneWinAppUtil.exe";
string cmd = string.Format("/C {0} -c {1} -s {2} -o {3} -q", tool, dbfPath, dbfFile, textBoxOutput.Text);
System.Diagnostics.Process.Start("CMD.exe", cmd);

Code 2:
var appPath = Application.StartupPath;
var dbfFile = Path.GetFileName(textBoxSource.Text);
var dbfPath = Path.GetDirectoryName(textBoxSource.Text);
var startInfo = new ProcessStartInfo();
startInfo.CreateNoWindow = false;
startInfo.UseShellExecute = false;
startInfo.FileName = appPath + @"\IntuneWinAppUtil.exe";
var c = (char)34;
startInfo.WindowStyle = ProcessWindowStyle.Hidden;
startInfo.Arguments = " -c " + c + dbfPath + c + " -s " + c + dbfFile + c + " -o " + c + textBoxOutput.Text + c + " -q";

What is happening - it fail when run, and no .intunewin file it comming in the output folder!

When running the SAME code if set to "Windows Console Host" the .intunewin file it comming in the output folder fine!

Thanks, please help or fix!

error

Any updates @stevgao ? :)