ClickOnce App Won't Update if Passed Command Line Arguments

Sprint

Well-known member
Joined
Feb 3, 2006
Messages
58
Location
Ohio
Programming Experience
5-10
I have a ClickOnce application deployed to many workstations in my office. On it's first run it adds a registry key to the HKCU run group that adds itself with a "-minimize" argument. On each login the program starts and seeing the command line argument minimizes itself . However when a update is published the program does not update. If the program is run from its menu shortcut without arguments it runs fine. I then looked up how to update programmaticaly and put that code into my program to run at startup but a my.application.isnetworkdeployed returns FALSE when command line arguments are passed to the app and TRUE when run without command line arguments even though in both cases it is network deployed.

Since my program starts up with command line arguments and stays minimized while the computer is on there is no reason for a user to close the program and reopen it through a menu item but as of right now that's the only way the program updates. Is this a bug or how ClickOnce is supposed to work?

Example: Create a new program. On the form add a textbox. In the Form load event put something like:

Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
TextBox1.Text = My.Application.Info.DirectoryPath.ToString & "\" & My.Application.Info.AssemblyName & ".exe"
MsgBox("Is my app network deployed?: " & My.Application.IsNetworkDeployed)
End Sub

Deploy the app. Start it with a menu item and it returns True. Start it with any command like argument (use the path from the box) and it returns false. Why? How is that possible? The app didn't magically become non network deployed because it was passed a command line argument. Anyone know how to fix this or is it a bug?

-Allan
 
I posted this on the Microsoft forums also and no reply there either. I'll have to rewrite my app so it's default behavior is to be minimized and you have to add a argument to make it normal size. This isn't the correct answer but all I can think of doing to make this update when started at window login. Still really seems like a bug...submitted a support request to MS.
 
Last edited:
Back
Top