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?
views:
249answers:
4When 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.
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.
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
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.