Squirrel / OldSquirrelForWindows

It's like ClickOnce but Works™
664 stars 55 forks source link

AppSetup in dll not being called #222

Open stefanolson opened 10 years ago

stefanolson commented 10 years ago

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

shiftkey commented 10 years ago

@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 commented 10 years ago

@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

stefanolson commented 10 years ago

@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.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.

shiftkey commented 10 years ago

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.

stefanolson commented 10 years ago

@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 commented 10 years ago

@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

shiftkey commented 10 years ago

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