首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >WixSharp:如何排除文件复制到目标目录?

WixSharp:如何排除文件复制到目标目录?
EN

Stack Overflow用户
提问于 2018-04-01 20:02:44
回答 2查看 396关注 0票数 1

我正在使用WixSharp来创建安装程序。我创建了一些自定义UI,其中一个具有简单的复选框,用于确定安装程序是否应覆盖配置文件。

是否可以创建自定义操作或其他导致扩展名为.config的文件不被复制的操作?我试图修改安装器数据库,但没有运气。

有什么想法吗?谢谢

EN

回答 2

Stack Overflow用户

发布于 2020-06-18 02:42:08

当您使用功能时,您可以选择执行一些操作,询问您是否选中了托管UI中的每个特定功能。

例如,我实现了这个ManagedProject,在这里我决定要包含哪些文件,而不是根据所选的功能。这只是一个例子,但由于版权限制,我不能包含整个代码。

代码语言:javascript
复制
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()来仅从特定目录获取文件。

我认为你应该看看这个链接上的例子:

WildCard sample from WixSharp

List directories issue at WixSharp

票数 1
EN

Stack Overflow用户

发布于 2018-04-02 20:09:02

不需要自定义操作。该复选框应具有与其关联的属性。根据此属性调整包含配置文件的组件的条件。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/49597837

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档