I have a C# WPF application and I've referenced that inside a MSIX package. I've also registered a URI protocol within the Package.appxmanifest of my MSIX package the following way:
<uap:Extension Category="windows.protocol" EntryPoint="AppLauncher"
Executable="AppLauncher\AppLauncher.exe">
<uap:Protocol Name="app-drive" >
</uap:Protocol>
</uap:Extension>
The goal is when I type app-drive:\\C:\test.txt
into the file explorer or a browser for my executable to launch and within it I want to have the following string accessible C:\test.txt
.
After I install my MSIX package and enter that string anywhere, my program launches correctly but that argument is nowhere to be found.
Ways I've tried to obtain it so far:
1.
[STAThread]
static void Main(string[] args)
{
// args[0] contains "-ServerName:App.AppXd****.mca" string
}
Environment.GetCommandLineArgs()
protected override void OnStartup(StartupEventArgs e)
All of these contain only the string "-ServerName:App.AppXd****.mca" as a first argument.
Note that I cannot use Windows.ApplicationModel.AppInstance.GetActivatedEventArgs()
since my application is not UWP.
Any suggestions?
Edit:
Found the solution. Turns out in order for the parameter to be passed to the executable the EntryPoint has to be EntryPoint="Windows.FullTrustApplication"
Found the solution. Turns out in order for the parameter to be passed to the executable the EntryPoint has to be EntryPoint="Windows.FullTrustApplication".