cbono
Posts: 42
Joined: Thu Aug 14, 2008 10:11 pm

.NET Installer Class Action: FileNotFoundException

Hello,

I'm evaluating the Professional edition of A.I., and so far I've liked what I've seen. However, I'm having trouble getting a .NET Installer Class custom action to work correctly. I'm going to provide as much information here as I can.

I have a custom Installer class that needs to accept some input from the user via an installation dialog, then write some data to the CONFIG file in the installation directory. The class is properly written, as we use it in our current install package (created in Visual Studio). It overrides the "Install" method, and it is packaged in a dll named "AppModeInstaller.dll". This DLL is part of the install and placed into the APPDIR.

In my AIP project, I created a .NET Installer Class custom action and placed it in the "InstallFinalize" phase of Install Sequence. I pointed it to the AppModeInstaller.dll that is placed in the Application Directory. A.I. fills in the the properties as appropriate, and with default action data.

To the Action Data I add 2 extra parameters: AppMode, which points to a custom property retrieved from one of the Dialogs, and TargetDir, which points to the APPDIR substitution variable:

Image

When I compile the project and run it, it fails when it tries to execute this custom action:
Image

Obviously it's looking for my AppModeInstaller.dll in the wrong directory. I don't know why; the execution log indicates that it has the correct location of my DLL, and that it is building out the correct parameter values (see the PROPERTY CHANGE line below):

Code: Select all

MSI (s) (CC:F0) [10:39:15:734]: Doing action: AI_DATA_SETTER
Action 10:39:15: AI_DATA_SETTER. 
Action start 10:39:15: AI_DATA_SETTER.
MSI (s) (CC:F0) [10:39:15:734]: PROPERTY CHANGE: Adding CustomActionData property. Its value is '/LogFile= /ReqVersion=2.0.50727 /InstallType=notransaction /Action=Install /AppMode="3" /TargetDir="C:\Program Files\Crosby\QuicCheck\" "C:\Program Files\Crosby\QuicCheck\AppModeInstaller.dll" "C:\DOCUME~1\cbono\LOCALS~1\Temp\dotNetCustAct.dll_Config.xml"'.
Action ended 10:39:15: AI_DATA_SETTER. Return value 1.
MSI (s) (CC:F0) [10:39:15:734]: Doing action: AppModeInstaller
Action 10:39:15: AppModeInstaller. 
Action start 10:39:15: AppModeInstaller.
MSI (s) (CC:44) [10:39:15:750]: Invoking remote custom action. DLL: C:\WINDOWS\Installer\MSI36C.tmp, Entrypoint: LaunchDotNetCustomAction
MSI (s) (CC:80) [10:39:15:750]: Generating random cookie.
MSI (s) (CC:80) [10:39:15:765]: Created Custom Action Server with PID 996 (0x3E4).
MSI (s) (CC:34) [10:39:15:781]: Running as a service.
MSI (s) (CC:C4) [10:39:15:781]: Hello, I'm your 32bit Impersonated custom action server.
Error 1001. Exception occurred while initializing the installation:
System.IO.FileNotFoundException: Could not load file or assembly 'file:///C:\WINDOWS\system32\Files\Crosby\QuicCheck\AppModeInstaller.dll' or one of its dependencies. The system cannot find the file specified..
MSI (s) (CC!68) [10:43:40:937]: 
MSI (s) (CC:44) [10:43:40:937]: Leaked MSIHANDLE (10) of type 790531 for thread 2920
MSI (s) (CC:44) [10:43:40:937]: Note: 1: 2769 2: AppModeInstaller 3: 1 
DEBUG: Error 2769:  Custom Action AppModeInstaller did not close 1 MSIHANDLEs.
The installer has encountered an unexpected error installing this package. This may indicate a problem with this package. The error code is 2769. The arguments are: AppModeInstaller, 1, 
Action ended 10:43:40: AppModeInstaller. Return value 3.
Action ended 10:43:40: INSTALL. Return value 3.
While this error message is open, I can browse to the Application Directory and confirm that the AppModeInstaller.dll is indeed there like it should be. I have no idea what to do differently to get the installer to stop looking in the Windows\System32 directory.

Any help is appreciated!

Regards,
Chris
Ionut
Posts: 605
Joined: Tue Nov 22, 2005 11:29 am
Contact: Website

Re: .NET Installer Class Action: FileNotFoundException

Hi Chris,

I think the problem is that the trailing "\" character from the value of APPDIR ("C:\Program Files\Crosby\QuicCheck\") causes the next quote character to be escaped. To prevent this, include a space character after "[APPDIR]" in the "Edit Installer Class Parameter", such that the value of the TargetDir parameter is "[APPDIR] " (it should appear like that in the "Action Data" field).

Another issue, although not related to the problem you are encountering, is the place where you have scheduled your Custom Action. You should add it under "Install" as "Deferred with no impersonation", because it performs system changes and it will fail if executed as Immediate in Vista.

Please let me know if this solves the problem.

Regards,
Ionut
Denis Toma
Advanced Installer Team
http://www.advancedinstaller.com/
cbono
Posts: 42
Joined: Thu Aug 14, 2008 10:11 pm

Re: .NET Installer Class Action: FileNotFoundException

Ionut,

Thanks! You were right, adding that space corrected the problem. And I appreciate the heads-up about where to let the Action run. I'm sure it saved me headaches down the road.

In terms of our evaluation of the product, we now have equivalent functionality to our current Visual Studio-based installer. Now I can move on to exploring the higher-level features that we're most interested in. So far, so good. I really like your product, and it's very helpful to have this forum to assist novice installer developers like me.


Best,
Chris
MartijnSchoemaker
Posts: 3
Joined: Tue Feb 10, 2009 5:26 pm

Re: .NET Installer Class Action: FileNotFoundException

Hello,

I also get an FileNotFoundException but I get it only when I set the option "Execution Properties" to "Deferred with no impersonation".
Normally our MSI installer runs under Windows XP / 2003 /etc. but now we have one customer with Windows Vista which got the error 2869 (http://blogs.x2line.com/al/archive/2007/07/20/3210.aspx).

So I set Deferred with no impersonation... But now I got an FileNotFoundException when I run the installer on Windows XP.

Hope somebody can help me!
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: .NET Installer Class Action: FileNotFoundException

Hi,

I'm not sure why you are encountering this behavior. Can you please send us the AIP you are using to support at advancedinstaller dot com so we can investigate it? Also, please attach a verbose log of the install process with the problem.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
MartijnSchoemaker
Posts: 3
Joined: Tue Feb 10, 2009 5:26 pm

Re: .NET Installer Class Action: FileNotFoundException

Hi,

maybe I am a noob now, but what is an AIP? :$
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: .NET Installer Class Action: FileNotFoundException

Hi,

Advanced Installer project files have the extension ".AIP". Therefore, through AIP we refer to the project file you created (for example "my installer.aip").

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
MartijnSchoemaker
Posts: 3
Joined: Tue Feb 10, 2009 5:26 pm

Re: .NET Installer Class Action: FileNotFoundException

Oops... :)
I will email it!
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: .NET Installer Class Action: FileNotFoundException

Hi,

We investigated the log you provided, but I'm afraid we cannot find the cause of this behavior. Perhaps there is a problem with Windows Installer or with the code of the custom action.
Running without impersonation will launch the custom action under the local system account, not under the current user account.

A solution would be to use two custom actions:
- one "Deferred with no impersonation" for Vista
- one "Deferred" for XP

The conditions of the custom actions can use the VersionNT property.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”