English 中文(简体)
如何设置或获取所有日志到自定义的上锁程序
原标题:How to set or get all logs in a custom bootstrapper application
  • 时间:2012-05-24 16:02:10
  •  标签:
  • wix
  • wix3.6

在我自定义的 Burn 管理的靴子应用程序中, 我想要一种设置安装器默认日志目录的方法, 这样客户可以很容易地找到安装日志 。 如果无法做到这一点, 我希望有合适的方法在安装后复制日志文件 。

我试图在我的设置工程(即 Bundle.wxs) 和我的管理靴子应用程序中设置 WixBundleLog 变量, 但没有成功。 另外, 我的靴子自动翻版程序足够通用, 所以可以用来安装各种产品/安装软件包, 所以我需要一个足够灵活的解决方案来设置/ 获得每个软件包的安装日志, 而不在我的靴子应用程序中硬码软件包名 。

似乎应该有办法做到这一点,而不要强迫用户在命令线上使用“-l”或“-log”。

最佳回答

WixBundleLog 是指定日志文件的刻录变量。 无法在包中覆盖它, 因为您无法在包含“ Wix” 前缀的包中设置变量。 套件应用程序中的覆盖也不管用, 因为靴子继续登录到默认值 。

燃烧的靴子trapper 设置了套件日志和安装日志的字符串变量。 我在一个列表中跟踪这些变量。 所以在我的构建器里, 我有一些类似的东西 :

this.LogsDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonDocuments), @"Company_NameLogsInstaller", DateTime.Now.ToString("yyyyMMdd_hhmmss"));
_logVariables = new List<string>();
_logVariables.Add("WixBundleLog");

Burn sets string variables for the log files in the format [WixBundleLog]_PackageId. In my bootstrapper application when the PlanPackageComplete event is fired, I have an event handler that includes the following code to add the variables to my list.

//set *possible* log variables for a given package
_logVariables.Add("WixBundleLog_" + e.PackageId);
_logVariables.Add("WixBundleRollbackLog_" + e.PackageId);

安装结束时,或如果我的靴子遇到错误,我称之为以下方法:

private void CopyLogs()
{
     if (!Directory.Exists(this.LogsDirectory))
         Directory.CreateDirectory(this.LogsDirectory);

     foreach (string logVariable in _logVariables)
     {
         if (this.Bootstrapper.Engine.StringVariables.Contains(logVariable))
         {
             string file = this.Bootstrapper.Engine.StringVariables[logVariable];
             if (File.Exists(file))
             {
                 FileInfo fileInfo = new FileInfo(file);
                 fileInfo.CopyTo(Path.Combine(this.LogsDirectory, fileInfo.Name), false);
             }
         }
     }
 }
问题回答

暂无回答




相关问题
3rd party Wix libraries

I am just getting started with Wix. I see there there a several libraries included with the default Wix install. I also see that users can create their own libraries(wixlibs). Are there any 3rd ...

Psake, Powershell & Wix

I have the below function as a part of my psake build. When the build is executing Candle.exe throws this error: candle.exe : warning CNDL1098: ext .BuildPackagesWixWebinWixIIsExtension.dll ...

wix custom dialog for config edit

hi i m trying make a setup msi for my application with wix v3 I have a problem about this task; I need a user input that will be stored in my application s config file (for example i need a dialog for ...

Closing an application using WiX

In creating my WiX installer I have run into an issue when trying to close an application before installing the upgrade. Below is an example of how I am attempting to do this. <util:...

Conditional uninstall of previous version in Wix

I m doing an installer for an software used for debugging embedded ARM cores (OpenOCD) and this installer automatically removes the previous versions - that s simple. However, sometimes that would be ...

热门标签