【发布时间】:2021-09-04 20:54:48
【问题描述】:
我正在使用 C# .NET 5.0 列出文件夹中的 PDF 文件,当双击某个项目时,它会使用 Windows 默认 PDF 查看器打开选定的 PDF。
我已经搜索了如何执行此操作,但解决方案代码引发了异常。
System.Diagnostics.Process.Start(@"C:\path\to\pdf\file.pdf");
错误:
System.ComponentModel.Win32Exception: 'The specified executable is not a valid application for this OS platform.'
有人可以帮我吗?
【问题讨论】:
-
ProcessStartInfo.UseShellExecute = true,例如Process.Start in Core 3.0 does not open a folder just by its name -- .Net Core 3.1 Process.Start("www.website.com") not working in WPF -
不工作...
-
您做错了什么或者没有与 PDF 类的 Shell 关联。 -- 不起作用 不是真正的信息,它什么也没说。你需要描述你做了什么以及你得到了什么具体的错误。
-
抱歉,同样的错误...
-
向我们展示您尝试过的代码,否则我们无法进一步帮助您...