2017-05-03 1 views
0
I am trying to update the web.config file while the installation process using the wix toolset 3.11. I am getting the error that xml node is not found while running the installer. I have tried this with xmlfile as well with xmlconfig with no success. Please help me in resolving this. 

„Fehler finden Knoten: // Konfiguration/connection/add [@ name = 'mydb " finden.] In wb.config XML-Datei"kann nicht XML-Knoten wix spath

Im Folgenden finden Sie die xml Datei:

<?xml version="1.0" encoding="utf-8" ?> 
<configuration> 
    <connectionStrings> 
    <add name="MYNAME" connectionString="Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=SOMEDB;Data Source=SOMEHOST" 
providerName="System.Data.SqlClient" /> 
    </connectionStrings> 
</configuration> 

Below is my code 

    <Component Id="cmpWebConfig" Guid="635F6999-89B4-42FF-89AC-9E2A710B42F8"> 
     <File Id="WEBCONFIG" Source="Web.Config" Name="Web.Config" KeyPath="yes"/> 
     <!--<util:XmlConfig Id="setConnString" File="[INSTALLFOLDER]Web.config" Action="create" On="install" Node="value" Name="connectionString" Value="Data Source=[DB_INSTANCE]; Initial Catalog=Customers;Integrated Security=SSPI" ElementPath="//configuration/connectionStrings/add[\[]@name='mydb'[\]]" Sequence="1" />--> 
     <util:XmlFile Id="ModifyConnectionString" 
Action="setValue" 
Permanent="yes" 
ElementPath="//configuration/connectionStrings/add[\[]@name='MYNAME'[\]]" 
Name="connectionString" 
File="[#WEBCONFIG]" 
Value="Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=mydb;Data Source=[SQLHOST]" 
SelectionLanguage="XPath" 
Sequence="1" /> 
     </Component> 
+0

Es gibt kein in Ihrer XML-Datei. – Rick

+0

nach der Aktualisierung des Wertes auch ich bin der gleiche Fehler, der Knoten existiert nicht, wenn das Installationsprogramm ausgeführt wird. –

Antwort

0

Dies wird Ihnen Ihr Problem lösen

entfernen Sie die zusätzlichen Schrägstrich vor elementpath

einfach kopieren.. und fügen Sie das ein und ändern Sie die Werte

<util:XmlFile Id="ModifyConnectionString" 
        Action="setValue" 
        Permanent="yes" 
        ElementPath="/configuration/connectionStrings/add[\[]@name='MigratorDB'[\]]" 
        Name="connectionString" 
        File="[INSTALLFOLDER]web.config" 
        Value='Data Source=[DB_SERVER]; Initial Catalog=[DB_DATABASE]; User Id=[MMDB_USER]; Password=[MMDB_PASSWORD];' 
        SelectionLanguage="XSLPattern" 
        Sequence="1" />