简体   繁体   English

NSIS安装程序(Unicode)以XML文件而不是“ <”“ <”的形式写入

[英]NSIS Installer (Unicode) writes in XML file instead of “<” “&lt;”

i have a little Problem with my NSIS script. 我的NSIS脚本有一个小问题。 I try to modify a connectionString in a config file. 我尝试在配置文件中修改connectionString。

I tried both compiler from NSIS (ANSII & Unicode) with the correct plugins.. in both cases in the XML file wasn't a "<" or ">" but two "& lt;" 我尝试使用NSIS(ANSII和Unicode)的两个编译器以及正确的插件..在两种情况下,XML文件中的文件都不是“ <”或““>”,而是两个“&lt;” (without the space between & and l). (在&和l之间没有空格)。

I use nsisXML as plugin. 我使用nsisXML作为插件。

Here my Code i tried it: 我在这里尝试了我的代码:

nsisXML::create
nsisXML::load "$INSTDIR\InvoiceConfigurator.exe.config"
nsisXML::select '/configuration/connectionStrings'
IntCmp $2 0 notFound
nsisXML::setText '<add name="InvoiceConfigurator.Properties.Settings.mdis_dbConnectionString" connectionString="Data Source=$DataBaseInstance;Initial Catalog=$DataBaseName;User ID=$DataBaseUser;Password=$DataBasePw;" providerName="System.Data.SqlClient" />'
nsisXML::save "$INSTDIR\InvoiceConfigurator.exe.config"
Goto end
notFound:
DetailPrint "InvoiceConfigurator.exe.config has not been adjusted!"
end:

The Message in DetailPrint is not shown ! 不显示DetailPrint中的消息!

Accordingly plugin homepage ( http://wiz0u.free.fr/prog/nsisXML/ ) this tool cannot insert subnodes as text like an JavaScript. 因此,插件主页( http://wiz0u.free.fr/prog/nsisXML/ )此工具无法像JavaScript一样将子节点插入为文本。 You should to insert each node and attributes manually. 您应该手动插入每个节点和属性。 Something like this: 像这样:

nsisXML::create
nsisXML::load "$INSTDIR\InvoiceConfigurator.exe.config"
nsisXML::select '/configuration/connectionStrings'
IntCmp $2 0 notFound
nsisXML::createElement "add"
nsisXML::setAttribute "name" "InvoiceConfigurator.Properties.Settings.mdis_dbConnectionString"
nsisXML::setAttribute "connectionString" "Data Source=$DataBaseInstance;Initial Catalog=$DataBaseName;User ID=$DataBaseUser;Password=$DataBasePw;"
nsisXML::setAttribute "providerName" "System.Data.SqlClient"
nsisXML::appendChild
nsisXML::save "$INSTDIR\InvoiceConfigurator.exe.config"
Goto end
notFound:
DetailPrint "InvoiceConfigurator.exe.config has not been adjusted!"
end:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM