OldSquirrelForWindows icon indicating copy to clipboard operation
OldSquirrelForWindows copied to clipboard

AppSetup in dll not being called

Open stefanolson opened this issue 12 years ago • 7 comments

In this issue I was advised to create a dll containing an IAppSetup derived class: https://github.com/Squirrel/Squirrel.Windows/issues/215.

So I have done this, but my .dll never gets called as far as I can tell because the shortcut name is not used:

public class CreateAppSetup : AppSetup
{
    public override string ShortcutName
    {
        get { return "My app name"; }
    }

In the install log, my DLL is never mentioned, but it does have lots of references to a particular DLL that can't load (one of mine - SharedServerClasses).

What can I do to tell it to load my DLL?

Stefan

stefanolson avatar Dec 01 '13 05:12 stefanolson

@stefanolson I'm seeing some failing tests with the IAppSetup bits.

Let me investigate as it's probably something that's come in as part of the renaming of things.

shiftkey avatar Dec 03 '13 12:12 shiftkey

@stefanolson could you also have a look in the Squirrel logs to see if (as I suspect) there's a ReflectionTypeLoadException like this:

[WARN][2013-12-03T12:43:17] InstallerHookOperations: Couldn't load types from module C:\Users\brendanforster\AppData\Local\Temp\c\SampleUpdatingApp\app-1.2.0.0\SampleUpdatingApp.exe: System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
   at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
   at System.Reflection.RuntimeModule.GetTypes()
   at Squirrel.Client.InstallerHookOperations.<findAppSetupsToRun>b__15(Module x) in c:\Users\brendanforster\Documents\GitHub\Squirrel.Windows\src\Squirrel.Client\InstallerHookOperations.cs:line 191
[WARN][2013-12-03T12:43:17] InstallerHookOperations: LoaderException found: System.IO.FileNotFoundException: Could not load file or assembly 'Shimmer.Client, Version=0.7.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
File name: 'Shimmer.Client, Version=0.7.0.0, Culture=neutral, PublicKeyToken=null'
...

https://github.com/squirrel/Squirrel.Windows/wiki/Diagnostics-and-Tracing

shiftkey avatar Dec 03 '13 12:12 shiftkey

@shiftkey Yes: [WARN][2013-12-02T09:52:37] InstallerHookOperations: Couldn't load types from module C:\Users\Stefan\AppData\Local\legacydocs\app-1.0.0\LegacyDocs.exe: System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information. at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module) at System.Reflection.RuntimeModule.GetTypes() at Shimmer.Client.InstallerHookOperations.<findAppSetupsToRun>b__15(Module x)

Which is the EXE file which doesn't actually contain the appsetup. The app setup is contained in SetupDll.dll and it doesn't appear to try and load that DLL as it is not mentioned at all in the log. At one point I did have the appsetup in the EXE, but still had the same exceptions. No idea why because the application runs perfectly fine, so all the DLLs are there.

stefanolson avatar Dec 03 '13 18:12 stefanolson

Oooh, I know this one!

https://github.com/Squirrel/Squirrel.Windows/blob/master/src/Squirrel.Client/InstallerHookOperations.cs#L176

We only scan *.exe - which is a decision made way back in the day.

As we really want people to not have IAppSetup components in their main application, this really should change to check .dll files as well.

shiftkey avatar Dec 04 '13 13:12 shiftkey

@shiftkey Well that would certainly explain it! I will try putting the code in an EXE next week and see if I can get it to work in the meantime

stefanolson avatar Dec 04 '13 16:12 stefanolson

@shiftkey using a .exe works! Yey! A DLL would be better, so I'll change back to that when a future release checks for DLLs. But at least it works in the meantime. Thanks

stefanolson avatar Dec 20 '13 02:12 stefanolson

@stefanolson great! I'll leave this open as a reminder to

  • add support for .dll files
  • possibly look to deprecate support for .exe files in the future

shiftkey avatar Dec 20 '13 03:12 shiftkey