无法使用XDocument创建WiX xml定义,因为它无法创建非法元素`&书信电报;?包括/&燃气轮机`
我想通过编程创建以下xml结构无法使用XDocument创建WiX xml定义,因为它无法创建非法元素`&书信电报;?包括/&燃气轮机`,xml,wix,linq-to-xml,Xml,Wix,Linq To Xml,我想通过编程创建以下xml结构 <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"> <?include "mypath\Constants.wxi"?> <Product Id="*" Name="$(var.ProductName)" Language="$(var.ProductLanguage)" Version="$(var.ProductVersion)" Manufacturer=
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<?include "mypath\Constants.wxi"?>
<Product Id="*" Name="$(var.ProductName)" Language="$(var.ProductLanguage)" Version="$(var.ProductVersion)" Manufacturer="$(var.ProductManufacturer)" UpgradeCode="$(var.ProductUpgradeCode)">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="A newer vesrion of [ProductName] is already installed" />
<UIRef Id="WixUI_Minimal" />
<MediaTemplate />
</Product>
</Wix>
我试着使用XDocument
XDocument xmldoc = new XDocument(
new XElement("Wix",
new XText("<?include \"" + constantfileloc + "\"?>"),
new XElement("Product",
new XAttribute("Id", "*"),
new XAttribute("Name", "$(var.ProductName)"),
new XAttribute("Language", "$(var.ProductLanguage)"),
new XAttribute("Version", "$(var.ProductVersion)"),
new XAttribute("Manufacturer", "$(var.ProductManufacturer)"),
new XAttribute("UpgradeCode", "$(var.ProductUpgradeCode)"),
new XElement("Package",
new XAttribute("InstallerVersion", "200"),
new XAttribute("Compressed", "yes"),
new XAttribute("InstallScope", "perMachine")
),
new XElement("MajorUpgrade",
new XAttribute("DowngradeErrorMessage", "A newer vesrion of [ProductName] is already installed")
),
new XElement("UIRef",
new XAttribute("Id", "WixUI_Minimal")
),
new XElement("MediaTemplate")
)
)
);
XDocument xmldoc=新XDocument(
新XElement(“Wix”,
新XText(“”),
新XElement(“产品”,
新的XAttribute(“Id”、“*”),
新XAttribute(“名称”、“美元(var.ProductName)”),
新XAttribute(“语言”,“美元(var.ProductLanguage)”),
新的XAttribute(“版本”、“$(var.ProductVersion)”),
新XAttribute(“制造商”,“美元(var.ProductManufacturer)”),
新XAttribute(“UpgradeCode”,“$(var.ProductUpgradeCode)”),
新XElement(“包”,
新XAttribute(“InstallerVersion”,“200”),
新XAttribute(“压缩”、“是”),
新XAttribute(“InstallScope”、“perMachine”)
),
新XElement(“MajorUpgrade”,
新XAttribute(“降级错误消息”,“已安装[ProductName]的较新vesrion”)
),
新的XElement(“UIRef”,
新XAttribute(“Id”、“WixUI_最小值”)
),
新XElement(“中间模板”)
)
)
);
问题当然是
是的,这是可能的。您看到的不是文本部分。他们在处理指令。您必须使用XProcessingInstruction而不是XText。退房您可以类似于以下方式使用它:
XDocument xmldoc = new XDocument(
new XElement("Wix",
new XProcessingInstruction("include", constantfileloc),
new XElement("Product",
new XAttribute("Id", "*"),
new XAttribute("Name", "$(var.ProductName)"),
new XAttribute("Language", "$(var.ProductLanguage)"),
new XAttribute("Version", "$(var.ProductVersion)"),
new XAttribute("Manufacturer", "$(var.ProductManufacturer)"),
new XAttribute("UpgradeCode", "$(var.ProductUpgradeCode)"),
new XElement("Package",
new XAttribute("InstallerVersion", "200"),
new XAttribute("Compressed", "yes"),
new XAttribute("InstallScope", "perMachine")
),
new XElement("MajorUpgrade",
new XAttribute("DowngradeErrorMessage", "A newer vesrion of [ProductName] is already installed")
),
new XElement("UIRef",
new XAttribute("Id", "WixUI_Minimal")
),
new XElement("MediaTemplate")
)
)
);
是的,有可能。您看到的不是文本部分。他们在处理指令。您必须使用XProcessingInstruction而不是XText。退房您可以类似于以下方式使用它:
XDocument xmldoc = new XDocument(
new XElement("Wix",
new XProcessingInstruction("include", constantfileloc),
new XElement("Product",
new XAttribute("Id", "*"),
new XAttribute("Name", "$(var.ProductName)"),
new XAttribute("Language", "$(var.ProductLanguage)"),
new XAttribute("Version", "$(var.ProductVersion)"),
new XAttribute("Manufacturer", "$(var.ProductManufacturer)"),
new XAttribute("UpgradeCode", "$(var.ProductUpgradeCode)"),
new XElement("Package",
new XAttribute("InstallerVersion", "200"),
new XAttribute("Compressed", "yes"),
new XAttribute("InstallScope", "perMachine")
),
new XElement("MajorUpgrade",
new XAttribute("DowngradeErrorMessage", "A newer vesrion of [ProductName] is already installed")
),
new XElement("UIRef",
new XAttribute("Id", "WixUI_Minimal")
),
new XElement("MediaTemplate")
)
)
);
是的,有可能。您看到的不是文本部分。他们在处理指令。您必须使用XProcessingInstruction而不是XText。退房您可以类似于以下方式使用它:
XDocument xmldoc = new XDocument(
new XElement("Wix",
new XProcessingInstruction("include", constantfileloc),
new XElement("Product",
new XAttribute("Id", "*"),
new XAttribute("Name", "$(var.ProductName)"),
new XAttribute("Language", "$(var.ProductLanguage)"),
new XAttribute("Version", "$(var.ProductVersion)"),
new XAttribute("Manufacturer", "$(var.ProductManufacturer)"),
new XAttribute("UpgradeCode", "$(var.ProductUpgradeCode)"),
new XElement("Package",
new XAttribute("InstallerVersion", "200"),
new XAttribute("Compressed", "yes"),
new XAttribute("InstallScope", "perMachine")
),
new XElement("MajorUpgrade",
new XAttribute("DowngradeErrorMessage", "A newer vesrion of [ProductName] is already installed")
),
new XElement("UIRef",
new XAttribute("Id", "WixUI_Minimal")
),
new XElement("MediaTemplate")
)
)
);
是的,有可能。您看到的不是文本部分。他们在处理指令。您必须使用XProcessingInstruction而不是XText。退房您可以类似于以下方式使用它:
XDocument xmldoc = new XDocument(
new XElement("Wix",
new XProcessingInstruction("include", constantfileloc),
new XElement("Product",
new XAttribute("Id", "*"),
new XAttribute("Name", "$(var.ProductName)"),
new XAttribute("Language", "$(var.ProductLanguage)"),
new XAttribute("Version", "$(var.ProductVersion)"),
new XAttribute("Manufacturer", "$(var.ProductManufacturer)"),
new XAttribute("UpgradeCode", "$(var.ProductUpgradeCode)"),
new XElement("Package",
new XAttribute("InstallerVersion", "200"),
new XAttribute("Compressed", "yes"),
new XAttribute("InstallScope", "perMachine")
),
new XElement("MajorUpgrade",
new XAttribute("DowngradeErrorMessage", "A newer vesrion of [ProductName] is already installed")
),
new XElement("UIRef",
new XAttribute("Id", "WixUI_Minimal")
),
new XElement("MediaTemplate")
)
)
);
谢谢你,我试了很多。。。键入,但忽略了XProcessingInstruction
。谢谢,我尝试了大多数X。。。键入,但忽略了XProcessingInstruction
。谢谢,我尝试了大多数X。。。键入,但忽略了XProcessingInstruction
。谢谢,我尝试了大多数X。。。类型,但忽略了XProcessingInstruction
。