Reputation: 2074
I have a WIX installer that calls two C# custom actions.
The first runs a routine to load the WIX session with default values into GUI prompts for application settings. The GUI then prompts the user during installation for new values, which stores the supplied settings to the session. This runs just fine and the user is then shown the prompts during the installer run.
After InstallFinalize, however, another custom action is supposed to run to take those saved settings, and write them to the database and registry. I have an external library I wrote that handles database connectivity, and this custom action attempts to load it and use it, failing with the following error:
Exception thrown by custom action:
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.IO.FileNotFoundException: Could not load file or assembly 'myCompany.PortalLib, Version=2.9.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
File name: 'myCompany.PortalLib, Version=2.9.0.0, Culture=neutral, PublicKeyToken=null'
at WIXCustomActions.CustomActions.SetBCAConfigOptions(Session session)
Details:
Need to get the custom actions to utilize myCompany.POrtalLib to be able to write to the server database...
UPDATE: I've tried including the .dll file in the WIX alongside the Packaged .dll for the custom actions, and referencing it within the XML as such (subbing "[" for HTML angle brackets):
[Binary Id="myCompany.PortalLib.dll" SourceFile="myCompany.PortalLib.dll" /]
...and I STILL get the "Could not load file or assembly" error above :(.
Upvotes: 2
Views: 2566
Reputation: 2074
Well I fixed this one too!
I noticed when I ran my packaging command using makesfxca, I was packaging the dll for the custom actions, the dll for windows installer, and the customaction.config. When I added a path to a valid dll for the myCompany.PortalLib.dll along with those three, when it came time to execute the function, it worked like a champ... So add all dependent external dlls into your packaged custom action DLL with makesfxca in order to have external DLLs included for use with your custom actions.
Upvotes: 6