我正在使用WixSharp来创建安装程序。我创建了一些自定义UI,其中一个具有简单的复选框,用于确定安装程序是否应覆盖配置文件。
是否可以创建自定义操作或其他导致扩展名为.config的文件不被复制的操作?我试图修改安装器数据库,但没有运气。
有什么想法吗?谢谢
发布于 2020-06-18 02:42:08
当您使用功能时,您可以选择执行一些操作,询问您是否选中了托管UI中的每个特定功能。
例如,我实现了这个ManagedProject,在这里我决定要包含哪些文件,而不是根据所选的功能。这只是一个例子,但由于版权限制,我不能包含整个代码。
var project = new ManagedProject($"My Tool {productVersion}",
new InstallDir(@"c:\tool",
new Dir(winServiceFeature, "admin_service",
new Files(winServiceFeature, $"{adminOutputDir}\\*.*",
f => f.EndsWith(".exe") ||
f.EndsWith(".exe.config") ||
f.EndsWith(".dll"))),
new Dir(winServiceFeature, "graph_service",
new Files(winServiceFeature, $"{graphOutputDir}\\*.*",
f => !f.Contains(".dll.config") &&
(f.EndsWith(".exe") ||
f.EndsWith("ServiceW.exe.config") ||
f.EndsWith(".dll"))),
new Dir(winServiceFeature, "simulation_service",
new Files(winServiceFeature, $"{simulationOutputDir}\\*.*",
f => f.EndsWith(".exe") ||
f.EndsWith("WebServiceW.exe.config") ||
f.EndsWith(".dll"))),
new Dir(winServiceFeature, "my_frontend",
new Files(winServiceFeature, $"{frontendDir}\\app\\*.*"),
httpWebSite,
httpsWebSite),
new Dir(winServiceFeature, "templates",
new DirFiles(winServiceFeature, $"{templatesOutputDir}\\*.*",
f => f.EndsWith("common_functions.xml")),
new Dir(firstCustomerFeature, "customer1",
new Files(firstCustomerFeature, $"{templatesOutputDir}\\customer1\\*.*",
f => f.EndsWith(".xml"))),
new Dir(secondCustomerFeature, "customer2",
new Files(secondCustomerFeature, $"{templatesOutputDir}\\customer2\\*.*",
f => f.EndsWith(".xml"))),
new Dir(@"%ProgramMenu%\My Suite\My Tool",
new ExeFileShortcut("Uninstall My Tool", "[System64Folder]msiexec.exe", "/x [ProductCode]")),
launcherInstallServiceAction,
launcherUninstallServiceAction,
adminInstallServiceAction,
adminUninstallServiceAction,
graphInstallServiceAction,
graphUninstallServiceAction,
simulationInstallServiceAction,
simulationUninstallServiceAction,
installCertificatesAction,
uninstallCertificatesAction);在这个示例中,我使用f => f.EndsWith()过滤器来过滤我想要在输出中使用的文件。我还使用新的DirFiles()来仅从特定目录获取文件。
我认为你应该看看这个链接上的例子:
或
发布于 2018-04-02 20:09:02
不需要自定义操作。该复选框应具有与其关联的属性。根据此属性调整包含配置文件的组件的条件。
https://stackoverflow.com/questions/49597837
复制相似问题