Im trying to add all output files of a given path to the installation that end in either .exe, .dll or .config, but the ways I have tried so far haven't worked.
This is what I've tried:
private static WixEntity[] getContents(string directory)
{
WixEntity[] contents = System.IO.Directory.GetFiles(directory)
.Where(f => f.EndsWith(".dll")
|| f.EndsWith(".exe")
|| f.EndsWith(".config"))
.Select(f => new File(f))
.ToArray();
contents = contents.Concat(System.IO.Directory.GetDirectories(directory, string.Empty, System.IO.SearchOption.TopDirectoryOnly)
.Select(d => new Dir(d.Split('\\').Last(), getContents(d)))
.ToArray()).ToArray();
return contents;
}
private static string buildMsi()
{
var project =
new ManagedProject(productName,
new Dir($"%ProgramFiles%\\{companyName}",
new Dir($"{productName} Files", getContents(clientFolderPath)),
***some other irrellevant stuff***);
}
as well as simply doing
private static string buildMsi()
{
var project =
new ManagedProject(productName,
new Dir($"%ProgramFiles%\\{companyName}",
new Dir($"{productName} Files", new Files(clientFolderPath, f => f.EndsWith(".dll")
|| f.EndsWith(".exe")
|| f.EndsWith(".config")),
***some other irrellevant stuff***);
}
Using the first method, I only get all the files from the folders but not the nested folders nor their contents. Using the second method, I get nothing at all.
How can I fix those, or what is an entirely different way I can get this to work?
Thanks!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.