Hi, I am using VS 2008 to create a Windows Installer setup.exe and setup.msi. It includes a merge module. The role of the merge module is to include another exe which runs custom commands by overriding the Install and Commit methods of Installer. Within those methods I attempt to execute another exe program, one of those installed by the setup program, which actually installs a windows service. I put the setup.exe and setup.msi files on a webserver and either run the setup.exe from within Internet Explorer or download it and run it from my hard drive. The installation initially proceeds as I would expect. However, I then get a popup error message with code 1001 saying that it could not find a file or assembly. The path it provides is not helpful and points at c:\windows\system32 I have generated MSI logs and snippets from the relevant section, I believe, are shown below:
MSI (s) (68:CC) [09:36:06:832]: Executing op: CustomActionSchedule(Action=EXEREG_CA__A0BD524433844251E1FD93077C55DAFF,ActionType=3154,Source=C:\Program Files\ABC Systems\myproduct\myservice.exe,Target=/REGSERVER,)
MSI (s) (68:CC) [09:36:08:969]: Executing op: ActionStart(Name=_429B8A1E_3170_4C8E_94A8_2AC8BA16CAE6.commit,,)
Action 09:36:08: _429B8A1E_3170_4C8E_94A8_2AC8BA16CAE6.commit.
MSI (s) (68:CC) [09:36:08:969]: Executing op: CustomActionSchedule(Action=_429B8A1E_3170_4C8E_94A8_2AC8BA16CAE6.commit,ActionType=3585,Source=BinaryData,Target=ManagedInstall,CustomActionData=/installtype=notransaction /action=commit /LogFile= /targ="C:\Program Files\ABC Systems\myproduct\\" /src="http://mywebserver/downloads/prod/\" /data="C:\ProgramData\\" "C:\Program Files\ABC Systems\myproduct\SetupLib.dll" "C:\Users\felix\AppData\Local\Temp\CFG71B5.tmp")
MSI (s) (68:CC) [09:36:08:969]: Executing op: ActionStart(Name=_ABFE89DF_6E86_45CF_ACCF_0903EF02DCA7.install,,)
Error 1001. Error 1001. Exception occurred while initializing the installation:
System.IO.FileNotFoundException: Could not load file or assembly 'file:///C:\Windows\system32\Files\ABC' or one of its dependencies. The system cannot find the file specified..
The setup program then rolls back and the installation fails. However, if I run the very same Setup.msi on my machine, i.e. not via the Setup.exe from the webserver - the installation proceeds normally throughout and the installation succeeds. Why? My feeling is that it must be something to do with the exe called from the Merge module. This is installed earlier by the setup program but it's at that stage that it fails when installed from the web. I would be very grateful for any help. Why should it work from the local disk but not over the web? Many thanks, -Paul | | pauldb Tuesday, July 14, 2009 9:18 AM | It's failing in the Commit custom action, or perhaps when trying to load your assembly in order to call it for the custom action. Do you know if your custom action actually starts at all (like with a messagebox as the first line of code)? Is everything inside the MSI file (no external cab files or external executables)? Phil Wilson | | PhilWilson Tuesday, July 14, 2009 9:46 PM | Hi Phil, Thanks for you reply. Yes, I tried putting a MessageBox.Show entry in both the Commit and Install methods of my custom actions and no dialogs appeared. However, these MessageBox dialogs do appear when I run the msi file directly from my hard disk. Indeed the msi successfully runs in that case. So I agree with your diagnosis - either it's not finding my merge module or the files that it references or its not running the commands when run from the web. The exe files used by the merged module/custom action are installed with everything else by the setup program. I see them appear momentarily in the correct location before the error message appears and the rollback removes the files. I'd be grateful for any suggestions as to what I can do next. I'm afraid that I'm lost. Thanks, -Paul
| | pauldb Wednesday, July 15, 2009 1:11 PM | Hi pauldb,
Sorry for the late reply.
From your description, setup.msi works fine when you install it on the local machine, but setup.exe from web server does not work.
Before we go any further, we need to know if it works fine in these cases:
1. Setup.msi on the local machine.
2. Setup.exe on the local machine.
3. Setup.msi via web.
4. Setup.exe via web.
This would tell us what the root cause is, the setup package type(msi/exe) or setup way(local machine or web).
The error you met is:
Could not load file or assembly 'file:///C:\Windows\system32\Files\ABC' or one of its dependencies. The system cannot find the file specified..
We need to check the items below to diagnose the error:
1. Where the installation program executes. On the local machine or the machine runs the web server?
2. Why it cannot load this file? Is that file exist?
If we know on which machine the setup program executes, we can do this by searching the directory.
Based on my understanding, this is the possible cause of the error: When you install via web, the setup program executes on the web server but the file it needs cannot be found on that machine. However, the file exists on your machine. So when the setup.msi executes on your machine, it can locate the file.
By the way, you and pauldb already figured out lots of important results. What we need to do now is to check the possible causes and find the root cause. We can change a factor of the environment each time and then check if it works.
Let me know if this works.
Aland Li
Please mark the replies as answers if they help and unmark if they don't. This can be beneficial to other community members reading the thread. | | Aland Li Thursday, July 16, 2009 8:26 AM | Hi Aland Li, Thanks for your reply. If I run the setup.msi from my machine or another, it works. If I run the setup.exe - it goes to the webserver and downloads and starts to run the msi - as it's supposed to. But, for some reason that I cannot explain, the msi fails when it tries to run the custom actions - when it has been downloaded by the setup.exe. It appears as though its either not finding those custom actions or they are failing for some other reason (the custom actions run one of the executables installed as part of the setup). The custom actions are inside a merge module. If the msi is copied to a machine and run locally, it works fine and the custom actions all work fine. I have now tried running the msi via Internet Explorer and that works aswell. So it only fails when done when the setup.exe has been downloaded or run via the browser. However, don't I need the exe because that contains the prerequisites and associated links? Many thanks, -Paul
| | pauldb Thursday, July 16, 2009 2:24 PM | Hi pauldb,
From your reply, I know you use the setup.exe to run the setup.msi but I do not know how you build the setup.exe. Would you mind answering these questions?
1. Did you create a Setup Project to generate the setup.exe and setup.msi?
2. Did you create another project and write some code to run the setup.msi, such as calling method Process.Start?
By the way, could you provide the source code, such as a Setup Project or a common project in which you build the setup.exe. I need to reproduce the error on my machine to diagnose the issue.
Best regards, Aland Li
Please mark the replies as answers if they help and unmark if they don't. This can be beneficial to other community members reading the thread. | | Aland Li Friday, July 17, 2009 1:40 AM | Hi Aland Li, Thanks for your help and for your interest. I did indeed create a Setup project in order to generate both the setup.exe and the setup.msi. I'm using Visual Studio 2008 Professional. On the Properties window, for the project, I either leave the "Installation URL" blank - if I want a setup.exe to run the msi from the local hard disk (that all works fine) - or I insert the URL of the folder containing the setup.exe and Setup.msi files if I'm installing from the web. I appreciate this would be easier if you had access to the source code, however, I'm unable to provide that at the current time. The issue appears to me to be that when ran from the web, the Class extending the Installer class, which is located in a DLL included in a Merge Module, cannot be found. If I run the msi directly (or use the setup.exe generated without an Installation URL and from the local machine), the class is found and its methods called. I included a reference to the Merge Module in the setup project by adding its 'primary output' to the Setup project's Files and under the 'Key Output' property, changed the Module Retargetable Folder to the Application Folder. I do see the files contained in the Merge Module appear in the application folder - during the install - until the failure causes the setup to rollback and remove the files again. Thanks, -Paul | | pauldb Friday, July 17, 2009 7:35 AM | Hi again, Surely the issue has to do with timing. My Installer class runs exe's that are also included in the Merge Module. Could it be that these, or the DLL containing the Installer class, are not installed before the setup program attempts to force the merge module to execute its custom actions and, therefore, it fails? For some reason, when installed locally, the files are installed in time and it all works. Does that make any sense? I tried not using the merge module and running the custom actions from the setup program itself - that failed again but with a more informative message. Referring to the DLL that contains my installer class, the error message was: Error 1001: Could not find InstallerClassDLL.InstallState. Edited to say: After I reverted back to using the merge module, I realised this was possibly because I wasn't calling the install method of my Installer class. But I had previously noticed that the InstallerClassDLL.InstallState file was not present when the installation was done via the web setup.exe. So, does this give any clues? Is it confirming that the DLL is not installed by the time the setup program/merge module attempts to run the custom actions contained within the DLL? Thanks, -Paul
- Edited bypauldb Friday, July 17, 2009 12:11 PM
-
| | pauldb Friday, July 17, 2009 8:10 AM | A couple of thoughts: Installer class custom actions that involve an installstate file need adding to every custom action node (Install, Commit etc). The file carries state, and things that happen later (uninstall, commit) expect the file to have been created. Even if you have no code, the base method needs calling.
Merge modules won't be the cause. After the build when they're merged they're not separate in some way. For example the internal MSI action InstallFiles just installs everything, whether it came from a merge moduler or not. Also, custom actions run after everything has been installed.
It does sound like a dependency issue because it's not getting into your custom action code. Have you dependencies on assemblies in the GAC?
Phil Wilson | | PhilWilson Friday, July 17, 2009 8:17 PM | Hi Phil, Thanks for your reply and for your thoughts. I now have custom actions for Install, Commit etc even if they do just call the base methods. In the Commit method of the Installer in the merge module, I call an exe program that is installed as part of the Merge Module. Nothing in the GAC at all - the exe that it calls is actually unmanaged code, setting up a windows service. The odd thing is that if I download and run the msi directly, it all works - it's only when I run the setup.exe, generated by VS2008, from the web that it fails. Could it be that the exe isn't signed and therefore fails whereas when the setup.msi runs locally, it receives the elevated security permissions it needs because they've been requested as part of the install? I'm not even sure about that though - because I put MessageBox.show commands in my Installer class - before the call to the exe - and no dialogs show. I really don't understand why it doesn't appear to be finding the Installer class. (I do sign the DLL containing the installer and the merge module, the setup.exe and the Setup.msi - all for good measure). -Paul | | pauldb Saturday, July 18, 2009 8:39 PM |
|