Dev
Posts: 17
Joined: Mon Oct 06, 2008 6:55 am

Problem running dotNetCustAct.dll to set ASP.Net 2.0

I'm trying to get a .Net custom DLL working to set ASP.Net 2.0 for an installed website. I've created a C# DLL which inherits from the Installer class, and has a RunInstaller attribute set to true. The class overrides Install, Commit, Rollback, and Uninstall methods, and sets the Committing and Committed events.

I have tried to execute it using dotNetCustAct.dll from within InstallExecuteSequence::Install - and also tried under Commit and InstallFinalize - but it does not appear to be executing my class.

Settings in Custom Action Properties:
Source Path: [actual path to project]\IISVersionCustomAction\bin\Debug\IISVersionCustomAction.dll
Source Type: DLL
Function Name: Install (although this shouldn't matter, right?)
Action data: /LogFile= /ReqVersion=2.0.50727 /InstallType=notransaction /Action=Install "[#IISVersionCustomAction.dll]" "[TempFolder]dotNetCustAct.dll_1_Config.xml"
Execution Props: Synchronous, ignore return code
Execution Options: Commit (also tried Immediate Execution, Deferred)
Scheduling Options: Always Execute
Expression Condition: NOT Installed
Run when patch is uninstalled: not checked
What am I doing wrong?
using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;
using System.Configuration.Install;
using System.Diagnostics;
using System.IO;
using System.Windows.Forms;

namespace IISVersionCustomAction
{
[RunInstaller(true)]
public class EnsureCLRV2 : Installer
{
public EnsureCLRV2()
: base()
{
this.Committed += new InstallEventHandler(EnsureCLRV2_Committed);
this.Committing += new InstallEventHandler(EnsureCLRV2_Committing);
}

public void Test()
{
string msg = "This is a test";
FileStream fs = new FileStream("c:\\temp\\writtenByInstaller.txt", FileMode.OpenOrCreate);
fs.Write(Encoding.Default.GetBytes(msg), 0, Encoding.Default.GetBytes(msg).Length);
fs.Close();
//return (1);
MessageBox.Show("Hello World");
}

private void EnsureCLRV2_Committing(object sender, InstallEventArgs e)
{

}

private void EnsureCLRV2_Committed(object sender, InstallEventArgs e)
{

}



public override void Install(System.Collections.IDictionary savedState)
{
base.Install(savedState);
string msg = "This is a test";

FileStream fs = new FileStream("c:\\temp\\writtenByInstaller2.txt", FileMode.OpenOrCreate);
fs.Write(Encoding.Default.GetBytes(msg), 0, Encoding.Default.GetBytes(msg).Length);
fs.Close();

}

public override void Commit(System.Collections.IDictionary savedState)
{
base.Commit(savedState);
string msg = "This is a test";

FileStream fs = new FileStream("c:\\temp\\writtenByInstaller2.txt", FileMode.OpenOrCreate);
fs.Write(Encoding.Default.GetBytes(msg), 0, Encoding.Default.GetBytes(msg).Length);
fs.Close();
}

public override void Rollback(System.Collections.IDictionary savedState)
{
base.Rollback(savedState);
}

public override void Uninstall(System.Collections.IDictionary savedState)
{
base.Uninstall(savedState);
}

}
}
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Problem running dotNetCustAct.dll to set ASP.Net 2.0

Hi,

Please note that a .NET Installer Class Action uses a custom DLL from Advanced Installer to run your DLL. When you create the custom action, you are prompted to select your DLL. After that, the "Source Path", "Source Type" and "Function Name" fields should not be modified.

Please recreate the custom action by not modifying this fields. The only reference to your DLL ("IISVersionCustomAction.dll") should be in the "Action Data" field.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Dev
Posts: 17
Joined: Mon Oct 06, 2008 6:55 am

Re: Problem running dotNetCustAct.dll to set ASP.Net 2.0

OK, that seems to be doing something now, but I'm getting error 2869 in the install with the code above. I see references to issues using APPDIR, but I'm literally using the code above and getting this error.
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Problem running dotNetCustAct.dll to set ASP.Net 2.0

Hi,

Please note that there is a discussion about this on the forum:
http://www.advancedinstaller.com/forums ... f=2&t=2118

If the problem persists, please send us the AIP (project) file you are using to support at advancedinstaller dot com so we can investigate it.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Dev
Posts: 17
Joined: Mon Oct 06, 2008 6:55 am

Re: Problem running dotNetCustAct.dll to set ASP.Net 2.0

Submitted - I'm making no attempt to pass in or use any properties as per the other thread you referenced.
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Problem running dotNetCustAct.dll to set ASP.Net 2.0

Hi Scott,

Your project seems to be configured correctly.

Other causes for this error may be:
1) You are testing the package on Vista. Please note that on Vista the custom actions which affect the system should run as "Deferred with no impersonation".
2) There is an exception in your custom action. I do not have experience with C#, so you should try to find the problem in the code.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Dev
Posts: 17
Joined: Mon Oct 06, 2008 6:55 am

Re: Problem running dotNetCustAct.dll to set ASP.Net 2.0

After a couple days and a bunch of emails, we determined that while my DLL was configured correctly in the installation, the actual DLL that I created was not actually installed on the target system at the time it was trying to execute my custom DLL.

So, if you get a 2868 error in the installation, and seeing "System.ArgumentException: String cannot have zero length" in the log - or depending on the OS actually getting a messagebox during the installation with "System.ArgumentException: String cannot have zero length", then check to make sure your DLL is actually present on the target system at the time the install gives that error. In particular, check the Organization/Features to make sure the DLL will be copied as you were expecting it to.

Cosmin has indicated that they will try to expose a more descriptive error in a future version.

Return to “Common Problems”