UnhandledException: System.ComponentModel.Win32Exception: No application is associated with the specified file for this operation
at System.Diagnostics.Process.StartWithShellExecuteEx(ProcessStartInfo startInfo)
at System.Diagnostics.Process.Start()
at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
at System.Diagnostics.Process.Start(String fileName)
大家好,
尝试使用 Process.Start 打开 .csv 文件时,我正在测试的一台机器上出现以下异常。我认为发生这种情况是因为在此框中没有为 .csv 文件设置文件关联。
那么你会如何避免这种情况呢?
强制 Process.Start 在记事本中打开? - 理想情况下,它应该在 excel 中打开,但是如果 excel 在该计算机上不存在怎么办?
谢谢
最佳答案
如果设置 ProcessStartInfo.ErrorDialog = true,则用户将收到标准 Windows 对话框提示:参见 here
关于c# - 没有应用程序与指定的文件异常关联,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2634198/