A little contribution that I found really useful

Nov 16, 2010 at 3:50 PM

So here's a first humble contribution in InstallerEditor :

When an embedded file is missing, we currently output in the console a debug message with the file(s) missing but once deployed the missing file is not shown anymore.

I added a user friendly list of missing files following the current message as follows, by only modifying  CheckFilesExist() in EmbedFileCollection.cs as follows:

        public void CheckFilesExist(InstallerLinkerArguments args)
        {
            int filesMissing = 0;
            string sMissingFiles = "";
            
            foreach (EmbedFilePair file in _files)
            {
                args.WriteLine(string.Format(" {0} ({1})", file.fullpath, file.relativepath));
                if (!File.Exists(file.fullpath))
                {
                    args.WriteError(string.Format("Embedded file '{0}' does not exist", file.fullpath));
                    sMissingFiles = sMissingFiles + "\n" + file.fullpath;
                    filesMissing++;
                }
            }

            if (filesMissing > 0)
            {
                throw new Exception(string.Format("Missing {0} embedded file(s), as follows:" 
                    + sMissingFiles, filesMissing));
            }
        }

Hope that helps,

-Fabien

Coordinator
Nov 16, 2010 at 9:26 PM

Thank you. I can certainly copy-paste the code, but it would be nice if you went through the hoops of contributing. Today it's something trivial, but I am sure you'll get a hang of it and will want to send something more substantial ;)

  • Create an SVN patch.
  • File an issue in the issue tracker.
  • Modify the Documentation\WhatsNew.html
  • Upload the patch.

 

Coordinator
Nov 17, 2010 at 11:05 AM

Btw, this may not be such a great idea. I often deal with hundreds if not thousands of files. This error message will not be very manageable.

Nov 17, 2010 at 2:55 PM
Edited Nov 17, 2010 at 6:38 PM

True,

I don't have more than a couple of errors usually, but thought about the same thing yesterday, so I added a max (10 first files listed) for now, to make it more robust. Having the paths of the first files is still a great help for the end user, so I think a patch like you suggested would be worth it IMHO.

Now talking of what I would like to be  done, in a longer term ; is certainly creating an error  log file archive, that could then probably be located at the same place where we write the exe output.

I added that to the Issue Tracker: 7689, with a patch available taking in account the display limit,

so feel to get a look at it.