ExcelDnaPack Requires the Output Path To Exist

Jul 14, 2014 at 4:10 PM
Hey All,

Not sure if this should be considered a bug or how the program functions, but the ExcelDnaPack program requires that the complete output path (specified by the /O command line switch) exist. Failure to do so will result in a DirectoryNotFoundException on line 141 of PackProgram.cs (as of when it attempts to copy over the base add-in xll.

The obvious work around to to ensure that the path exists before attempting to copy to output to it.

Should you want the program to create this path I'd suggest something similar to this prior to attempting to copy to that path:
string outputDirectory = Path.GetDirectoryName(xllOutputPath);
You'll probably want to add more defensive code around this call as it can possibly throw if the end user does not have permission to write to that directory.

At a minimum you should attempt to check to see if the directory exists before copying to that location and then throw an error on the command line to indicate that the directory must exist. That can be accomplished by a simple Directory.Exists(string) check as the above does.
Jul 14, 2014 at 6:29 PM
Thank you for the suggestion.
I've added the directory creation code as you suggest.