I\'m using the following code with System.Deployment
to return the ClickOnce version of my .NET 3.5 C# application:
public string version
{
I've isolated the problem. I won't pretend to understand exactly how ClickOnce works, but basically, if you launch the executable file directly it won't run in "ClickOnce mode". This means it won't check for updates and won't get the correct version number (since it isn't actually network deployed).
The best solution I've found so far is to point to the ClickOnce .appref-ms file rather than the .exe file. This file is like a shortcut of sorts, and is in the start menu.
Here's the code I'm using to get the location of my app's .appref-ms file:
string allProgramsPath = Environment.GetFolderPath(Environment.SpecialFolder.Programs);
string shortcutPath = Path.Combine(allProgramsPath, keyName);
shortcutPath = Path.Combine(shortcutPath, keyName) + ".appref-ms";
And then I combine that with my previous code to set that location in the registry.