如何使用 .NET Core 中的默认编辑器打开文本文件

BDe*_*vGW 5 .net c# file .net-core

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

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

如何从testfile.txt我的默认应用程序开始?谢谢!

Ism*_*lla 10

像这样打开它:

new Process
{
    StartInfo = new ProcessStartInfo(filename)
    {
        UseShellExecute = true
    }
}.Start();
Run Code Online (Sandbox Code Playgroud)