I'm still newbie and still learning how to do a good installer, but I have some questions again : How can I print logs session?
I have for example :
[CustomAction]
public static ActionResult CheckDatabaseExist(Session session)
{
try
{
session.Log("CheckDatabaseExist: Begin");
var builder = getSqlConnectionsStringBuilder(session);
using (var connection = new SqlConnection(builder.ConnectionString))
{
SqlCommand someCommand = new SqlCommand();
someCommand.Connection = connection;
someCommand.Parameters.Add("@databaseName", SqlDbType.NChar).Value = session.CustomActionData["DATABASE_NAME"];
using (var command = new SqlCommand(string.Format("SELECT db_id('@databaseName')") ,connection))
{
session.Log("command is: " + command);
if (command.ExecuteScalar() != DBNull.Value)
{
session["DATABASE_EXISTED"] = "1"; // existed
}
else
{
session["DATABASE_EXISTED"] = string.Empty; // did not exist
}
}
}
session.Log("CheckDatabaseExist: End");
}
catch (Exception ex)
{
session.Log("CheckDatabaseExist: exception: {0}", ex.Message);
throw;
}
return ActionResult.Success;
}
I want to have all my log in a file?
I tried this command line :
msiexec /i DatabaseScriptsInstall.msi /L*V log.txt
But I do not have the session log...
Any idea?? It will be very helpful for me, I didn't find answer yet.
Thanks