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:
What am I doing wrong?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
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);
}
}
}
FOLLOW US
Get the latest news in Application Packaging