How to install or retrieve all the logs in a user download application

In my custom Burning bootstrapper app, I need a way to set the default log directory for the installer so that clients can easily find installation logs. If this cannot be done, I would like to have a suitable way to copy the log files after installation.

I tried unsuccessfully to set the WixBundleLog variable in my setup project (i.e. Bundle.wxs) and in my managed boot application. In addition, my bootstrap application is fairly general, so it can be used with various installation products / packages, so I need a solution flexible enough to install / receive installation logs for each package without hard-coding the package name in my boot application.

There seems to be a way to do this without forcing the user to use "-l" or "-log" on the command line.

+3
source share
1 answer

WixBundleLog - , . , , "Wix". bootstrapper , bootstrapper .

. . - :

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

[WixBundleLog] _PackageId. bootstrapper, PlanPackageComplete , , , .

//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);
             }
         }
     }
 }
+10

All Articles