我只是试图显示一个PDF文件,从我的.NET毛伊应用程序在Windows上,这是给我以下错误。
"System.ComponentModel.Win32Exception:‘试图使用工作目录’C:\WINDOWS\system32 32‘启动进程'C:\Users\Documents\helpfile.pdf’时出错。指定的可执行文件对此操作系统平台不是有效的应用程序。“
我的密码在下面。它在WPF应用程序中工作过,但在这里不起作用。
Process.Start("C:\\Users\\<username>\\Documents\\helpfile.pdf"); // removed the username here and above in error message也尝试过:(从安装目录获取helpfile.pdf )
string _asmPath = Assembly.GetExecutingAssembly().Location;
int lastIndex = _asmPath.LastIndexOf('\\');
string helpfilePath = $"{_asmPath.Substring(0, lastIndex)}\\helpfile.pdf";
ProcessStartInfo startInfo = new ProcessStartInfo(helpfilePath);
Process.Start(startInfo);我也得到了一个类似的错误:"System.ComponentModel.Win32Exception:‘一个错误发生了,试图用工作目录’C:\WINDOWS\system32 32‘启动进程System.ComponentModel.Win32Exception。指定的可执行文件对于这个操作系统平台来说不是一个有效的应用程序。“
如何在helpfile.pdf上的毛伊岛应用程序中打开这个PDF文档( Win10 )?
谢谢你的帮助!
发布于 2022-10-11 00:56:09
使用启动器
await Launcher.Default.OpenAsync(new OpenFileRequest("Some Title", new ReadOnlyFile(filepath)));https://stackoverflow.com/questions/74021836
复制相似问题