I'm trying to associate an application with a particular file type and then use that file when the application starts up. It's pretty trivial to Create File Associations For a ClickOnce Application:

Publish Options > File Associations

This currently works, so if I have an file with the extension ".tester," my Click Once Deployed application will fire up.

The problem I'm having trouble with is identifying which file launched the application.

According to the question What Event is Triggered When Opening a Custom File?, the "file should be available from the command line args", and this Scott Hanselman Article confirms.

However, when I add the following code, I don't get anything besides the path to the executable when firing the application.

<!-- language: lang-vb -->
Dim args = Environment.GetCommandLineArgs()
MsgBox(Join(args, ", "))

Command Line Args

I have confirmed that I'm fetching all the command line arguments. When I launch the file from the actual command line with some bogus arguments:

<!-- language: lang-none -->
C:\FileHandler.exe -foo bar

The application will display the following:

args 2

How do I identify the file that initiated the application?