views:

14

answers:

1

I have added some custom actions to our installer which is run on CE5 and WM6. This installer works fine and builds fine. There is however one annoyance. The setup.dll is deployed to the device and this file is not necessary.

I've read several websites on creating a setup.dll file, MSDN and even the mobile SDK. They all state the same set of steps.

  1. Create your C++ dll project.
  2. Ensure the output is called setup.dll.
  3. On your cab project click on CE Setup DLL, browse, application folder, add output and select your setup project. (You cannot select a local directory, its always a directory on the target machine)

Now this does work and produce a custom cab installer. However as mentioned the setup.dll is copied across into the application folder, even though it is not required after installation (not even for the uninstall)

I tried to exclude the setup.dll by setting exclude to true in its properties. All this does is not include the file a all so the cab files to build as the setup.dll is missing.

As such the only solution i have arrived at is manually changing the cab .inf the file from

[DefaultInstall]
CEShortcuts=Shortcuts
AddReg=RegKeys
CopyFiles=Files.Common1,Files.Common2,Files.Common3,Files.Common4
CESetupDLL="Setup.dll"

to

[DefaultInstall]
CEShortcuts=Shortcuts
AddReg=RegKeys
CopyFiles=Files.Common1,Files.Common2,Files.Common3
CESetupDLL="Setup.dll"

Where Files.Common4 pointed to the setup.dll file locally on the machine. Doing this change means it is used to build the cab file, but the file is not copied across.

Is there anyway of doing this change in visual studio, or is it always going to be a manual edit of the .inf file and the a manual build of the cab file with cabwiz.exe?

+1  A: 

I'm a bit confused. You've created a setup.dll installer extension, and included it in the CAB, but you don't want it on the device? In order for your custom actions to execute during the CAB extraction, the DLL has to be in the CAB and extracted on the device.

If you don't want it on the device, simply omit it from the CopyFiles and delete the CESetupDLL entry from the INF. Obviously doing this then means whatever custom actions it defines cannot run.

To be clear, this DLL that you're referencing is for custom on-device actions during install and/or uninstall. It will not provide any desktop functionality.

ctacke
That is precisely what I am trying to achieve. Use setup.dll to build the CAB file but not copy it to the device. I too I did not think custom actions would run without the DLL. But using the above workaround the setup.dll is not installed on the device (not marked as to be copied), but on uninstall my custom actions do appear to run.Its only a minor gripe that I thought would be easy to fix and i had overlooked something obvious.
JonWillis
The device is not magic. The custom action cannot occur without the DLL present on the device becasue it has to run some code. Now it might not be where you think it is, but it absolutely must be there. My guess is that it's somehow ending up in the \Windows folder - maybe it's running a version you pushed down with the debugger. I'd certainly verify the CAB on a completely clean (i.e. has been hard reset) device.
ctacke
I did wonder how it managed to run the uninstall code without the DLL present, I agree it needs to run custom code from somewhere... Im assuming it was magically stored elsewhere and installing setup.dll to the application folder was surplus to requirements, given when uninstalling a cab file a record of files installed is kept somewhere in the system for wceload.exe to use on the uninstall. A clean boot of the OS is the only way to test this for sure to see if it was being cached from a previous install. Ill try to do it now...
JonWillis
I have tried it on a clean boot, with a manually edited .inf file to create the cab file.The setup.dll is *not* copied into the application folder with the work around mentioned in the question. Yet the custom code still runs on install and uninstall. Registry keys are made, dialogs are displayed, reboots occur as listed in the custom code. Since this is the case i do not see why visual studio forces you to include it in the project in a directory somewhere if it is not used.
JonWillis
The two places I'd check: the Windows folder (where the loader would still find it and be able to use it) and in the app directory, but marked as hidden.
ctacke
Ill recheck those places in the morning when in work again, I too am confident it is placed somewhere, but if its somewhere you don't need to know about why can't visual studio do that for you ;)
JonWillis
Sorry for the delay, I'm away from work for a few weeks. But I did not see it where it was installed. There probably is some magic directory. What i may do next time I build it is compare the file size to see if the one with setup.dll to be installed is smaller. End of the day the uninstaller knows what was installed so that to is stored somewhere!
JonWillis