-
Notifications
You must be signed in to change notification settings - Fork 176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Run SqlScript on custom condition #1668
Comments
I also tried adding FeatureCondition: But then I get the following error: And I have the current feature generated:
|
That's odd. The wxs with the correct placement of the condition attribute I shared before, was generated from the SqlDatabase sample. I only added your condition to the code. I suggest you check the example by yourself as the wrong placement of the condition can be the cause you are looking for. Though, the WiX compiler did not complain. Strange... Note the current version of WiX v4-5 requires the condition to be an attribute and in v3 it is an element. |
I'm using WiX v3. I've actually just find a way in which it works. I left the SqlScript element without ComponentCondition: And when the
As a result from this
Now I have this
This is working for me as I test it. Do you think there is a better way I can do this |
No, the way you do it is quite OK. You need to apply a condition but since the direct entity (SQL script) does not support conditions then you have to apply it to its parent. Which parent? It's your call. Feature or Component both are OK. I only suggest you do the subfeatures directly with WixSharp entities instead of XML injection. The same outcome but the code looks cleaner. var binaries = new Feature("MyApp Binaries", "Application binaries", "FEATURE_INSTALL_PATH2");
var docs = new Feature("MyApp Documentation");
var docsLight = new Feature("MyApp Light Documentation");
var tuts = new Feature("MyApp Tutorial") { Condition = new FeatureCondition("SQLSCRIPT=\"False\"", level: 1) };
var test = new Feature("TEST");
docs.Add(tuts);
binaries.Add(docs);
binaries.Add(docsLight); Have a look at the corresponding FeatureCondition sample |
Hello,
I'm trying to run SqlScript, but only if my property SQLSCRIPT is set to True.
new SqlScript("db", "script_binary_id", ExecuteSql.OnInstall) { ComponentCondition = "SQLSCRIPT='True'" },
I've tried doing it with ComponentCondition, but it didn't solved the problem. Is there a way I can set custom condition like mine, and if the condition matches then the script gets executed?
The text was updated successfully, but these errors were encountered: