我正在使用WixSharp来构建我的安装程序。在我的项目中,我有:
new Files(
new Feature("RootFilesFeature"),
Path.Combine(C_SERVICE_RELEASE_PATH,"*.*"),
(lFilename) => !lFilename.StartsWith("appsettings", true)
)不管这个谓词是什么,我仍然安装了appsettings.json和appsettings.development.json。
我做错了什么?
发布于 2021-01-22 21:02:27
我认为这是因为lFilename是文件的名称,包括它的路径。
如果在您的情况下是可能的,那么使用Contains
new Files(
new Feature("RootFilesFeature"),
Path.Combine(C_SERVICE_RELEASE_PATH,"*.*"),
(lFilename) => !lFilename.Contains("appsettings")
)或EndsWith
new Files(new Feature("RootFilesFeature"),
Path.Combine(C_SERVICE_RELEASE_PATH, "*.*"),
(lFilename) => !lFilename.EndsWith("appsettings.json", true) ||
!lFilename.EndsWith("appsettings.development.json", true)
)发布于 2021-03-02 23:15:04
如果要同时排除"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)
)https://stackoverflow.com/questions/65845329
复制相似问题