Reputation: 369
I am using Visual Studio 2010, with the Votive addin on Windows 7, .net4, and the latest WiX 3.7 to create an msi.
The install is quite complex, and works fine when I test it on my pc.
During the install, I run some custom actions. One of those custom actions needs an external SQLite dll for database access that is only required by the custom action.
When I run it on a pc that doesn't have my dev environment, just plain windows 7, I get a file not found error. This, it would seem obvious is because SQLite has not been installed on this pc.
The error I get is:
System.IO.FileNotFoundException: Could not load file or assembly 'System.Data.SQLite.dll' or one of its dependencies. The specified module could not be found.
I can see from the verbose log that the custom action is being extracted to a temp file locally to run. This is an extract from the log file:
(SERVER) MSI (s) (74:C0) [09:08:07:527]: Executing op: ActionStart(Name=InitializeDbDeferred,,)
(UNKNOWN) Action 09:08:07: InitializeDbDeferred.
(SERVER) MSI (s) (74:C0) [09:08:07:528]: Executing op: CustomActionSchedule(Action=InitializeDbDeferred,ActionType=1025,Source=BinaryData,Target=InsertDefaultRepositoryDeferred,CustomActionData=DATA=C:\AXS Standalone NVR;REPOSITORYPATH=C:\AXS Repository - (Available Space: 364 (Gb));QUOTA=25)
(SERVER) MSI (s) (74:88) [09:08:07:530]: Invoking remote custom action. DLL: C:\Windows\Installer\MSI4252.tmp, Entrypoint: InsertDefaultRepositoryDeferred
(UNKNOWN) SFXCA: Extracting custom action to temporary directory: C:\Users\Admin\AppData\Local\Temp\MSI4252.tmp-\
(UNKNOWN) SFXCA: Binding to CLR version v4.0.30319
(UNKNOWN) Calling custom action CustomAction!CustomAction.CustomAction.InsertDefaultRepositoryDeferred
(UNKNOWN) Exception thrown by custom action:
(UNKNOWN) System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.IO.FileNotFoundException: Could not load file or assembly 'System.Data.SQLite.dll' or one of its dependencies. The specified module could not be found.
(UNKNOWN) at CustomAction.CustomAction.InsertDefaultRepositoryDeferred(Session session)
(UNKNOWN) --- End of inner exception stack trace ---
My question is, how do I get the Custom Action to 'see' the SQLite dll during the install when the CA is being run from a temp location? Do I have to 'package the CA and it's dlls together somehow.
I have tried including the SQLite dll as a file in the installer, but the CA in the temp location would not 'know' where it was.
I just can't see how to get the CA to find the SQLite dll.
Upvotes: 2
Views: 2353
Reputation: 55571
I'm leaving my other answer since it's useful info for other scenarios but I think the problem today is simpler.
When you add a reference to a DTF C# custom action project using Votive, it automatically sets CopyLocal=False if the assembly name starts with the word "System.". This is to avoid packaging up DLL's typically found in the .NET Framework. However, Microsoft has gotten into the habit of shipping "System" assemblies with other redistributables.
So try changing the CopyLocal to True for that reference and see if it gets better. The System.Data and System.Transactions that Ralph mentioned ships with the framework.
Upvotes: 3
Reputation: 55571
Could not load file or assembly 'System.Data.SQLite.dll' or one of its dependencies
DTF automatically takes all the project content and assembly references and compresses them into the final native DLL. You should see the SQLLite assembly in the temp directory during the lifetime of the custom action.
You'll notice the error message says "or one of its dependencies". I would take a look at the DLL using ILDASM or .NET Reflector and see what that DLL's references are. Then add them to your DTF project as either items (content copy) or references. The goal is to get them to be packaged in the final DLL and make it to the temp directory.
Upvotes: 3