【问题标题】:How to open a textfile with the default editor in .NET Core如何在 .NET Core 中使用默认编辑器打开文本文件
【发布时间】:2020-02-01 16:23:00
【问题描述】:

在 .NET Framework 中,我可以简单地执行 Process.Start(filename); 但在 .NET Core 中我得到了这个异常:

System.ComponentModel.Win32Exception: '指定的可执行文件不是 此操作系统平台的有效应用程序。'

如何使用我的默认应用启动testfile.txt? 谢谢!

【问题讨论】:

标签: c# .net file .net-core


【解决方案1】:

像这样打开它:

new Process
{
    StartInfo = new ProcessStartInfo(filename)
    {
        UseShellExecute = true
    }
}.Start();

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-03-28
    • 2013-02-28
    • 2012-11-17
    • 1970-01-01
    • 2012-08-03
    • 2021-09-22
    相关资源
    最近更新 更多