[英]How to add all contents of build folder to installation using Wix#?
我試圖將給定路徑的所有輸出文件添加到以 .exe、.dll 或 .config 結尾的安裝中,但到目前為止我嘗試過的方法沒有奏效。
這是我嘗試過的:
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***);
}
以及簡單地做
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***);
}
使用第一種方法,我只從文件夾中獲取所有文件,而不是嵌套文件夾及其內容。 使用第二種方法,我什么也得不到。
我該如何解決這些問題,或者有什么完全不同的方式可以讓它發揮作用?
謝謝!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.