首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Squirrel.windows在桌面上创建多个快捷方式

Squirrel.windows在桌面上创建多个快捷方式
EN

Stack Overflow用户
提问于 2017-03-23 08:03:51
回答 1查看 2.5K关注 0票数 2

我们正在尝试使用Squirrel.Windows为我们的.NET应用程序创建一个安装程序,该应用程序包含多个.exe文件。我们使用命令:

代码语言:javascript
复制
squirrel --releasify BIN_PATH\MyApp.2.0.33404.nupkg

然而,当运行setup.exe时,它在桌面上创建多个快捷方式对应于多个.exe文件,如何指定只创建一个快捷方式?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-05-15 16:59:07

松鼠文献声明,为包中的每个EXE创建快捷方式是默认行为。

同样的文件页解释说,要覆盖默认行为,您需要至少让EXE松鼠中的一只知道,然后根据需要实现松鼠事件处理程序。

您最好通过将以下内容添加到它的AssemblyInfo.cs中,使您希望为松鼠提供一个快捷方式。

代码语言:javascript
复制
[assembly: AssemblyMetadata("SquirrelAwareVersion", "1")]

然后在EXE中实现松鼠事件,如下所示:

代码语言:javascript
复制
static bool ShowTheWelcomeWizard;
...
static int Main(string[] args) 
{
    // NB: Note here that HandleEvents is being called as early in startup
    // as possible in the app. This is very important! Do _not_ call this
    // method as part of your app's "check for updates" code.

    using (var mgr = new UpdateManager(updateUrl))
    {
        // Note, in most of these scenarios, the app exits after this method
        // completes!
        SquirrelAwareApp.HandleEvents(
          onInitialInstall: v => mgr.CreateShortcutForThisExe(),
          onAppUpdate: v => mgr.CreateShortcutForThisExe(),
          onAppUninstall: v => mgr.RemoveShortcutForThisExe(),
          onFirstRun: () => ShowTheWelcomeWizard = true);
    }
}
票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/42970309

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档