如何使用WIX工具集打印日志会话?

时间:2016-09-29 14:09:14

标签: session logging wix

我还是新手,还在学习如何做好安装程序,但我又有一些问题:如何打印日志会话?

我有例如:

 [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;
    }

我想将所有登录文件都记录下来?

我尝试了这个命令行:

msiexec /i DatabaseScriptsInstall.msi /L*V log.txt

但我没有会话日志...

任何想法?这对我很有帮助,我还没有找到答案。

谢谢

0 个答案:

没有答案