Squirrel.Windows icon indicating copy to clipboard operation
Squirrel.Windows copied to clipboard

Icon two times in Windows Program and Features

Open ricardopolo opened this issue 12 years ago • 16 comments

I just created an installer. When I install the app using the Setup.exe appears the icon in the Desktop and in the control panel.

The app has this in its code

 using (var mgr = new UpdateManager(@"https://URL.com", "ID", FrameworkVersion.Net45))
{
   await mgr.UpdateApp();
 }

The strange behavior is that when the the code above runs, the program appears two times in the control panel. image

Why could this happen?

ricardopolo avatar Nov 17 '14 06:11 ricardopolo

@ricardopolo Can you give me a .reg file containing HKCU\Software\Microsoft\Windows\CurrentVersion\Uninstall?

anaisbetts avatar Nov 17 '14 07:11 anaisbetts

Here it is https://dl.dropboxusercontent.com/u/300838/Uninstall.reg

I see two entries, one with the name of the Nuget and one with the name of the Publisher

ricardopolo avatar Nov 17 '14 11:11 ricardopolo

I also see that in AppData are two folders created image

One contains Update.exe and the other one not.

ricardopolo avatar Nov 18 '14 19:11 ricardopolo

@ricardopolo Your "ID" needs to match the NuGet package ID - we really should just remove this as an option in the constructor

anaisbetts avatar Nov 18 '14 19:11 anaisbetts

@paulcbetts it matches. My UpdateManger looks like this

using (var updateManager = new UpdateManager(@"https://signtul.blob.core.windows.net/outlook-addin", "Tulpep.Signtul.OutlookAddIn", FrameworkVersion.Net45))

And my NuSpec

<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
    <metadata>
        <id>Tulpep.Signtul.OutlookAddIn</id>
        <version>$version$</version>
        <title>Signtul Outlook AddIn</title>
        <authors>Tulpep</authors>
        <projectUrl>http://www.signtul.com/</projectUrl>
        <iconUrl>http://www.signtul.com/Content/Img/favicon.ico</iconUrl>
        <requireLicenseAcceptance>false</requireLicenseAcceptance>
        <description>Tulpep Signtul Outlook AddIn</description>
    </metadata>

ricardopolo avatar Nov 18 '14 19:11 ricardopolo

@paulcbetts do you know where can I find more information or what nexts steps should we take in order to fix this one?

ricardopolo avatar Nov 21 '14 17:11 ricardopolo

@ricardopolo Can you send me a built nupkg file?

anaisbetts avatar Nov 21 '14 20:11 anaisbetts

@paulcbetts off course. Here it is

This is the nupkg https://signtul.blob.core.windows.net/outlook-addin/Tulpep.Signtul.OutlookAddIn-1.0.414-full.nupkg This is the Setup.exe https://signtul.blob.core.windows.net/outlook-addin/Setup.exe This is the Releases file https://signtul.blob.core.windows.net/outlook-addin/RELEASES

This is code called from the Main function of the program

using (var updateManager = new UpdateManager(@"https://signtul.blob.core.windows.net/outlook-addin", "Tulpep.Signtul.OutlookAddIn", FrameworkVersion.Net45))
{
 await updateManager.UpdateApp();
}

ricardopolo avatar Nov 26 '14 01:11 ricardopolo

@ricardopolo Can you try rigging up correct handling of Squirrel-based events? Check out https://github.com/Squirrel/Squirrel.Windows/blob/master/docs/squirrel-events.md for more info - while I haven't found any smoking gun yet, this is definitely a thing you need to fix in your app that would cause the installer to do Weird Stuff.

anaisbetts avatar Nov 26 '14 01:11 anaisbetts

We have tried:

                    SquirrelAwareApp.HandleEvents(
                        onInitialInstall: v => updateManager.CreateUninstallerRegistryEntry(),
                        onAppUpdate: v => updateManager.CreateUninstallerRegistryEntry(),
                        onAppUninstall: v => RemoveOutlookAddin()
                        );

Wit not luck. Looks like it Updates every time (even when Install) and more weird... in every Update the Uninstaller should not be created, isn't it?

ricardopolo avatar Nov 26 '14 02:11 ricardopolo

Can you instead try:

SquirrelAwareApp.HandleEvents(
    onInitialInstall: v => InstallOutlookAddin(),
    onAppUpdate: v => InstallOutlookAddin(),
    onAppObsolete: v => RemoveOutlookAddin(),
    onAppUninstall: v => RemoveOutlookAddin());

Put this code as early as possible in startup.

anaisbetts avatar Nov 26 '14 02:11 anaisbetts

Added onAppObsolete as recommended

                SquirrelAwareApp.HandleEvents(
                    onInitialInstall: v => updateManager.CreateUninstallerRegistryEntry(),
                    onAppUpdate: v => updateManager.CreateUninstallerRegistryEntry(),
                    onAppObsoleted: v => updateManager.RemoveUninstallerRegistryEntry(),
                    onAppUninstall: v => RemoveOutlookAddin()
                    );

A new installation: image

ricardopolo avatar Nov 26 '14 02:11 ricardopolo

@ricardopolo I don't think you should be calling XYZUninstallerRegistryEntry

anaisbetts avatar Nov 26 '14 05:11 anaisbetts

Leaving only this in the code:

using (var updateManager = new UpdateManager(@"https://signtul.blob.core.windows.net/outlook-addin", "Tulpep.Signtul.OutlookAddIn", FrameworkVersion.Net45))
                {                    
                    SquirrelAwareApp.HandleEvents(
                        onAppUninstall: v => RemoveOutlookAddin()
                  );
                await updateManager.UpdateApp();
}

Still two links in the Programs and Features menu, and two folders in %localappdata%. @paulcbetts Any Idea? Maybe if create a public repo with the problem can you check please?

ricardopolo avatar Nov 26 '14 15:11 ricardopolo

@paulcbetts by my side this issued is closed!

I could replicated multiple times, so would be great if you check this:

With this nuspec file it generates two folders in %localappdata% and two entries in Program and Features.

<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
    <metadata>
        <id>Tulpep.Signtul.OutlookAddIn</id>
        <version>1.0.658</version>
        <title>Signtul Outlook AddIn</title>
        <authors>Tulpep</authors>
        <projectUrl>http://www.signtul.com/</projectUrl>
        <iconUrl>http://www.signtul.com/Content/Img/favicon.ico</iconUrl>
        <requireLicenseAcceptance>false</requireLicenseAcceptance>
        <description>Tulpep Signtul Outlook AddIn</description>
    </metadata>
    <files>
        <file src="..\Tulpep.Signtul.OutlookAddin\bin\Release\**\*.*" target="lib\net45\" />
    </files>
</package>

With this one it works good

<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
    <metadata>
        <id>SigntulOutlookAddIn</id>
        <version>1.0.658</version>
        <authors>Tulpep</authors>
        <projectUrl>https://signtul.com/</projectUrl>
        <iconUrl>https://signtul.com/Content/Img/favicon.ico</iconUrl>
        <requireLicenseAcceptance>false</requireLicenseAcceptance>
        <description>Tulpep Signtul Outlook AddIn</description>
    </metadata>
    <files>
        <file src="..\Tulpep.Signtul.OutlookAddin\bin\Release\**\*.*" target="lib\net45\" />
    </files>
</package>

I don't know if maybe Title or an Id with dots generates this strange behavior, but only removing this two attributes and changing the Id in the UpdateMangaer fixes the issue.

ricardopolo avatar Dec 15 '14 03:12 ricardopolo

How to update the same package in squirrel again & again without new version. Eg: I want to update the v1.0.1 two times? is there any possibility. No new folder should be created. it should update the existing package in the file location.

Adeshtalakane avatar Mar 29 '19 10:03 Adeshtalakane