Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
117 views
in Technique[技术] by (71.8m points)

c# - WixSharp including appsettings, regardless of predicate

Im using WixSharp to build my installer. In my project, I have this :

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

Regardless of that predicate, I still get appsettings.json and appsettings.development.json installed.

What am I doing wrong?

question from:https://stackoverflow.com/questions/65845329/wixsharp-including-appsettings-regardless-of-predicate

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I think it's because lFilename is the name of the file including it's path.

If it's possible in your case then use Contains

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

or EndsWith

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...