Get path to the file that launched the application #697

Closed
opened 2026-01-29 16:46:12 +00:00 by claunia · 1 comment
Owner

Originally created by @MSiffert on GitHub (Sep 8, 2021).

Originally assigned to: @GregorBiswanger on GitHub.

Considering we have one for more file associations inside our electron.manifest.json

"fileAssociations": [
  {
    "ext": "sdg",
    "name": "SDG",
    "role": "Editor"
  }
]

There should be an API inside the Electron API to see how the App was launched.
Environment.GetCommandLineArgs() does not contain any information about the file that launched the application because these parameters are not passed to the dotnet process by the Electron host.
Environment.GetCommandLineArgs() will always only include the following parameters:

  • environment
  • electronPort
  • electronWebPort

This is extremely common for desktop applications and should, at least in my opinion, be an essential feature.
Note: I am using .NET 5 and Blazor Server

Originally created by @MSiffert on GitHub (Sep 8, 2021). Originally assigned to: @GregorBiswanger on GitHub. Considering we have one for more file associations inside our `electron.manifest.json` ``` "fileAssociations": [ { "ext": "sdg", "name": "SDG", "role": "Editor" } ] ``` There should be an API inside the Electron API to see how the App was launched. `Environment.GetCommandLineArgs()` does not contain any information about the file that launched the application because these parameters are not passed to the dotnet process by the Electron host. `Environment.GetCommandLineArgs()` will always only include the following parameters: - environment - electronPort - electronWebPort This is extremely common for desktop applications and should, at least in my opinion, be an essential feature. Note: I am using .NET 5 and Blazor Server
claunia added the Feature label 2026-01-29 16:46:12 +00:00
Author
Owner

@GregorBiswanger commented on GitHub (Mar 28, 2023):

🎉🚀 New Electron.NET version 23.6.1 released 🚀🎉

With native Electron 23 and .NET 6 support. Your problem should be fixed here. If you continue to have the problem, please let us know. Please note the correct updating of your API & CLI. Info in the README. Have fun!

@GregorBiswanger commented on GitHub (Mar 28, 2023): 🎉🚀 New Electron.NET version 23.6.1 released 🚀🎉 With native Electron 23 and .NET 6 support. Your problem should be fixed here. If you continue to have the problem, please let us know. Please note the correct updating of your API & CLI. Info in the README. Have fun!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/Electron.NET#697