Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AppSetup in dll not being called #222

Open
stefanolson opened this issue Dec 1, 2013 · 7 comments
Open

AppSetup in dll not being called #222

stefanolson opened this issue Dec 1, 2013 · 7 comments

Comments

@stefanolson
Copy link

In this issue I was advised to create a dll containing an IAppSetup derived class: Squirrel/Squirrel.Windows#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
Copy link
Contributor

shiftkey commented Dec 3, 2013

@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
Copy link
Contributor

shiftkey commented Dec 3, 2013

@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
Copy link
Author

@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
Copy link
Contributor

shiftkey commented Dec 4, 2013

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
Copy link
Author

@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
Copy link
Author

@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
Copy link
Contributor

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants