如何在自动更新期间将 .NET 应用程序固定到任务栏?

发布于 2024-08-25 13:08:54 字数 85 浏览 10 评论 0原文

当 ClickOnce AutoUpdate 部署的应用程序在 Windows 7 上自动更新时,该应用程序将从任务栏取消固定。有没有办法阻止它变得不固定?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

眼泪也成诗 2024-09-01 13:08:54

如果未安装 ClickOnce 应用程序,则很可能无法实现此目的。
安装后;我不知道。

ClickOnce 应用程序将下载到用户的临时目录中。当应用程序下载最新版本时,该版本将存储在新的子目录中,并且不会像“正常”应用程序更新那样被覆盖。

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.

怼怹恏 2024-09-01 13:08:54

我不知道如何防止它被取消固定,但有一种方法使用 vbs 脚本来固定 exe,这不应该通过代码来实现:

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

这本质上依赖于具有“Pin”的 exe 的右键单击菜单到任务栏”条目。不幸的是,除非有人有所有翻译的列表,否则它会使其成为特定的英语。

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.

七七 2024-09-01 13:08:54

我根本没有看到这个问题。我假设您在第一次运行应用程序时手动将应用程序固定到任务栏。

您的目标是 .NET 3.5 (SP-1) 吗?您是让 ClickOnce 为您创建桌面快捷方式还是以编程方式执行此操作?桌面快捷方式消失了吗?

每次发布更新时,它都会从任务栏消失吗?或者只是每隔一段时间?

罗宾点网

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

过潦 2024-09-01 13:08:54

我不确定 Windows 7 如何处理它,但我使用类似于 将 appref-ms 复制到开始菜单上的启动文件夹。我认为我的代码(在我的工作机器上,我周末休息)还会检查这是否是新安装,因此如果是更新,它不会更改快捷方式。

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.

混吃等死 2024-09-01 13:08:54

在 Visual Studio 2010 的“发布”选项卡上。我单击“选项”、“选定清单”,然后单击“创建桌面快捷方式”。在发布更新并且用户安装更新后,此功能由开始菜单快捷方式保留。以前,开始菜单快捷方式会消失并且必须重新固定。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文