Don't worry about the project I see now the problem you are trying to solve. It looks like you are trying to set an action condition. This is what wasn't clear for me.
> Why CDATA has been removed from conditions by default?
I am not sure Wix# ever used CData by default for all WiX types/elements. (Though may be I just don't remember).
Anyway, currently Wix# checks if the Condition
value has any XML delimiter and encodes it as a CData if any detected. However it looks like in your case the detection algorithm failed and Wix# missed that fact that your
interferes with XML encoding. That is why I really need to know what was your condition value that did not trigger the CData encoding.
> ...It looks like for example, that document.Root.Select("Product") returns a value, but can't reach:...
Correct. You are using XDocument
to access it and most likely it can be only accessed with use of proper XML namespaces. Anyway, I always encourage users to use Wix# XML extensions for accessing the elements transparently by the "local
names". The syntax that you were looking for is as follows:
static void Project_WixSourceGenerated(XDocument document)
var element = document.Root.Select("Product/InstallExecuteSequence")
.First(x => x.Value == "MY_CONDITION");
element.ReplaceNodes(new Condition("<your condition>").ToCData());
However in your case you don't have to do XML injection as you can force CData encoding in a more direct way:
AutoElements.ForceCDataForConditions = true;
As for the auto detection of CData triggering conditions I will proceed with the fix when I have a sample of the "offending"