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

C# Squirrel.windows在桌面上创建多个快捷方式,c#,github,installation,clickonce,squirrel.windows,C#,Github,Installation,Clickonce,Squirrel.windows,我们正在尝试为我们的.NET应用程序创建一个使用Squirrel.Windows的安装程序 应用程序包含多个.exe文件。 我们使用命令: squirrel --releasify BIN_PATH\MyApp.2.0.33404.nupkg 但是,当运行setup.exe时,它会在桌面上创建对应于multi.exe文件的多快捷方式 如何指定仅创建一个快捷方式 声明为包中的每个EXE创建快捷方式是默认行为 这也解释了,要覆盖默认行为,您需要使至少一个EXE Squirrel感知,然后根据需要实

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

squirrel --releasify BIN_PATH\MyApp.2.0.33404.nupkg
但是,当运行setup.exe时,它会在桌面上创建对应于multi.exe文件的多快捷方式 如何指定仅创建一个快捷方式

声明为包中的每个EXE创建快捷方式是默认行为

这也解释了,要覆盖默认行为,您需要使至少一个EXE Squirrel感知,然后根据需要实现Squirrel事件处理程序

您最好将以下内容添加到其
AssemblyInfo.cs
,从而使您想要的EXE成为Squirrel感知的快捷方式:

[assembly: AssemblyMetadata("SquirrelAwareVersion", "1")]
然后在EXE中实现类似于以下内容的Squirrel事件:

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);
    }
}