We have a .NET 4.5.2 application we're bringing forward to .NET 5.0.
We have a bit where we write a file and want to open it in the user's configured default editor.
In .NET 4.5, this was easy:
// If we're showing SQL, load the output file
if (myOptions.outputSql)
{
if (File.Exists(myOptions.outputFilename))
Process.Start(myOptions.outputFilename);
}
But in .NET 5.0 this throws an exception:
The specified executable is not a valid application for this OS platform.
What I want to do is to spawn whatever is the default application for the specified file, and pass it the file. In .NET 4.5, ProcessStart() would do this. In .NET 5.0 it no longer does.
So, how do I accomplish this, now?