I'm evaluating AI and I wanted to try to run a simple .NET Custom Action. So I created a new C# 2008 DLL project, added the following code:
Code: Select all
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
namespace customaction
{
[System.ComponentModel.RunInstallerAttribute(true)]
public class MyCustomAction : System.Configuration.Install.Installer
{
public MyCustomAction()
{
}
public int LaunchDotNetCustomAction(String msg)
{
FileStream fs = new FileStream(Environment.GetEnvironmentVariable("TEMP") + "\\writtenByInstaller.txt", FileMode.OpenOrCreate);
fs.Write(Encoding.Default.GetBytes(msg), 0, Encoding.Default.GetBytes(msg).Length);
fs.Close();
return (1);
}
}
}
I don't know what to do, nor where to find resources about these .NET custom actions... I know there's probably simpler ways to achieve the writing of a file, but it's only a test. I want to use the .NET actions to do much more evolved actions in the final installer.
Could you please give me some leads to follow to achieve this ?
Thanks a lot,
Best regards,
Nicolas.