微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

WixSharp 包括 appsettings,无论谓词如何

如何解决WixSharp 包括 appsettings,无论谓词如何

我使用 WixSharp 来构建我的安装程序。在我的项目中,我有这个:

new Files(
    new Feature("RootFilesFeature"),Path.Combine(C_SERVICE_RELEASE_PATH,"*.*"),(lFilename) => !lFilename.StartsWith("appsettings",true)
)

不管那个谓词,我仍然安装了 appsettings.json 和 appsettings.development.json。

我做错了什么?

解决方法

如果你想同时排除“appsettings.json”和“appsettings.development.json”,你必须在它们之间加上&&而不是||

new Files(new Feature("RootFilesFeature"),Path.Combine(C_SERVICE_RELEASE_PATH,"*.*"),(lFilename) => !lFilename.EndsWith("appsettings.json",true) && 
                   !lFilename.EndsWith("appsettings.development.json",true)
)

,

我认为这是因为 lFilename 是包含路径的文件名。

如果您的情况可能,请使用 Contains

new Files(
    new Feature("RootFilesFeature"),(lFilename) => !lFilename.Contains("appsettings")
)

EndsWith

new Files(new Feature("RootFilesFeature"),true) || 
                   !lFilename.EndsWith("appsettings.development.json",true)
)

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。