NSIS 安装程序 (Unicode) 写入 XML 文件而不是 "<" "<"
NSIS Installer (Unicode) writes in XML file instead of "<" "<"
我的 NSIS 脚本有点问题。我尝试修改配置文件中的 connectionString。
我用正确的插件尝试了 NSIS(ANSII 和 Unicode)的两个编译器。在这两种情况下,XML 文件中的不是“<”或“>”,而是两个“<”。 “ (没有 & 和 l 之间的 space)。
我使用 nsisXML 作为插件。
这是我试过的代码:
nsisXML::create
nsisXML::load "$INSTDIR\InvoiceConfigurator.exe.config"
nsisXML::select '/configuration/connectionStrings'
IntCmp 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:
未显示 DetailPrint 中的消息!
因此,插件主页 (http://wiz0u.free.fr/prog/nsisXML/) 此工具无法像 JavaScript 那样将子节点作为文本插入。
您应该手动插入每个节点和属性。像这样:
nsisXML::create
nsisXML::load "$INSTDIR\InvoiceConfigurator.exe.config"
nsisXML::select '/configuration/connectionStrings'
IntCmp 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:
我的 NSIS 脚本有点问题。我尝试修改配置文件中的 connectionString。
我用正确的插件尝试了 NSIS(ANSII 和 Unicode)的两个编译器。在这两种情况下,XML 文件中的不是“<”或“>”,而是两个“<”。 “ (没有 & 和 l 之间的 space)。
我使用 nsisXML 作为插件。
这是我试过的代码:
nsisXML::create
nsisXML::load "$INSTDIR\InvoiceConfigurator.exe.config"
nsisXML::select '/configuration/connectionStrings'
IntCmp 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:
未显示 DetailPrint 中的消息!
因此,插件主页 (http://wiz0u.free.fr/prog/nsisXML/) 此工具无法像 JavaScript 那样将子节点作为文本插入。 您应该手动插入每个节点和属性。像这样:
nsisXML::create
nsisXML::load "$INSTDIR\InvoiceConfigurator.exe.config"
nsisXML::select '/configuration/connectionStrings'
IntCmp 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: