Donate

Process.Start() Error - An error occurred trying to start process. The specified executable is not a valid application for this OS platform.

Good evening!

I had an issue when opening PDF files using Process.Start() which is called in a ShowFile() method of the project. The code which isn't working is shown below.
System.Diagnostics.Process.Start(Path.Combine(myDocumentsPath, fileName));
The solution for that is to pass a ProcessStartInfo() object in the Start() parameter. And then set UseShellExecute property of the ProcessStartInfo object to true. The modified code that is working is shown below.
System.Diagnostics.Process.Start(new ProcessStartInfo(Path.Combine(myDocumentsPath, fileName)) { UseShellExecute = true });
Output

Comments

Donate

Popular Posts From This Blog

WPF CRUD Application Using DataGrid, MVVM Pattern, Entity Framework, And C#.NET

TypeScript Error Or Bug: The term 'tsc' is not recognized as the name of a cmdlet, function, script file, or operable program.

Invalid nested tag div found, expected closing tag input