When an application deployed by ClickOnce AutoUpdate is automatically updated on Windows 7, the application becomes unpinnned from the taskbar. Is there a way to stop it from becoming unpinned?
5 Answers
When the ClickOnce application is not installed it most likely impossible to achieve this. When it's installed; i'm not sure.
A ClickOnce application is downloaded to the users' temporary directory. When the application downloads the latest version, this version is stored in a new sub directory and not overwritten as which is the case with 'normal' application updates.

- 6,017
- 2
- 31
- 49
I don't know about keeping it from being unpinned but there is a way using a vbs script to pin an exe which isn't supposed to be doable by code:
Call AddToTaskbar("C:\temp\", "MyExe.exe")
Function AddToTaskbar (Path, File)
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace(Path)
Set objFolderItem = objFolder.ParseName(File)
Set colVerbs = objFolderItem.Verbs
For Each objVerb in colVerbs
If Replace(objVerb.name, "&", "") = "Pin to Taskbar" Then
'WScript.Echo objVerb
objVerb.DoIt
End If
Next
End Function
This essentially relies on the right click menu of an exe having the "Pin to Taskbar" entry. It unfortunately makes it english specific unless someone has a list of all translations.

- 18,754
- 26
- 95
- 132
-
3The problem is you don't want to pin the [exe] file from a CLickOnce application. If you run it by running the [exe] instead of the appref-ms file, it won't run as a ClickOnce app and look for updates and check the deployment files, etc. – RobinDotNet Mar 29 '10 at 23:21
In Visual Studio 2010 on the publish tab. I clicked options, Selected Manifests and clicked Create desktop shortcut. This preserved by start menu shortcuts after an update was published and users installed the update. Previously the start menu shortcut would disappear and have to be re-pinned.

- 358
- 3
- 9
- 23
I'm not seeing this problem at all. I'm assuming you manually pinned the application to the task bar the first time you ran it.
Are you targeting .NET 3.5 (SP-1)? Are you having ClickOnce create the desktop shortcut for you or are you doing it programmatically? Does the desktop shortcut disappear?
Does it disappear from the taskbar every time an update is released, or just every so often?
RobinDotNet

- 11,723
- 3
- 30
- 33
-
Yes, I manually pinned the application. It disappears every time an update is released. – ryantm Apr 03 '10 at 21:25
-
I'm not sure how Windows 7 handles it, but I use code similar to this to copy the appref-ms to the startup folder on the start menu. I think my code (on my work machine and I'm off for the weekend) also has a check for if this is a new install so it does not change the shortcut if it is an update.

- 1,753
- 15
- 25
-
With .NET 3.5 SP-1, they added the ability to have a shortcut added to the desktop created automatically. When they did that, they also added a bit that removes the shortcut every time an update is issued, and if you have their checkbox checked, it puts it back. So if you are copying their shortcut to your desktop (as we do, so it's the actual C/O shortcut), you have to do it every time or it disappears. Doesn't matter what version of .NET you target; will happen if machine has .NET 3.5 SP-1 installed. Just FYI. – RobinDotNet Apr 03 '10 at 07:57