Web部署参数化问题

时间:2017-08-01 16:55:07

标签: xpath sitecore webdeploy microsoft-web-deploy parameterization

我遇到了一个Sitecore项目的问题。问题是某些参数不会被替换......我已经在下面显示的G​​itHub存储库中重现了这个问题。

https://github.com/jopmiddelkamp/Web-Deploy-Parameters-issue

使用下面的parameters.xml文件,我尝试替换Sitecore EXM MAT的邮件服​​务器值。

<?xml version="1.0" encoding="utf-8" ?>
<parameters>
  <parameter name="Mail Server" description="Mail server to enter into config" tags="Hidden,NoStore" defaultValue="__MailServer__">
    <parameterEntry kind="XmlFile" scope="App_Config\\Include\\Sitecore\.Smtp\.config$" match="//sitecore/settings/setting[@name='MailServer']/@value" />
    <parameterEntry kind="XmlFile" scope="App_Config\\Include\\EmailExperience\\Sitecore\.EDS\.Providers\.CustomSmtp\.config$" match="//sitecore/exm/eds/smtpSettings/server/text()" />
  </parameter>
  <parameter name="Mail Server User Name" description="Mail Server User Name to enter into config" tags="Hidden,NoStore" defaultValue="__MailServerUserName__">
    <parameterEntry kind="XmlFile" scope="App_Config\\Include\\Sitecore\.Smtp\.config$" match="//sitecore/settings/setting[@name='MailServerUserName']/@value" />
    <parameterEntry kind="XmlFile" scope="App_Config\\Include\\EmailExperience\\Sitecore\.EDS\.Providers\.CustomSmtp\.config$" match="//sitecore/exm/eds/smtpSettings/userName/text()" />
  </parameter>
  <parameter name="Mail Server Password" description="Mail Server Password to enter into config" tags="Hidden,NoStore" defaultValue="__MailServerPassword__">
    <parameterEntry kind="XmlFile" scope="App_Config\\Include\\Sitecore\.Smtp\.config$" match="//sitecore/settings/setting[@name='MailServerPassword']/@value" />
    <parameterEntry kind="XmlFile" scope="App_Config\\Include\\EmailExperience\\Sitecore\.EDS\.Providers\.CustomSmtp\.config$" match="//sitecore/exm/eds/smtpSettings/password/text()" />
  </parameter>
  <parameter name="Mail Server Port" description="Mail Server Port to enter into config" tags="Hidden,NoStore" defaultValue="__MailServerPort__">
    <parameterEntry kind="XmlFile" scope="App_Config\\Include\\Sitecore\.Smtp\.config$" match="//sitecore/settings/setting[@name='MailServerPort']/@value" />
    <parameterEntry kind="XmlFile" scope="App_Config\\Include\\EmailExperience\\Sitecore\.EDS\.Providers\.CustomSmtp\.config$" match="//sitecore/exm/eds/smtpSettings/port/text()" />
  </parameter>
  <parameter name="EXM Mail Server SSL or TLS Enabled" description="EXM Mail Server SSL/TLS enabled to enter into config" tags="Hidden,NoStore" defaultValue="__MailServerSslOrTlsEnabled__">
    <parameterEntry kind="XmlFile" scope="App_Config\\Include\\EmailExperience\\Sitecore\.EDS\.Providers\.CustomSmtp\.config$" match="//sitecore/exm/eds/smtpSettings/startTls/text()" />
  </parameter>
  <parameter name="EXM Mail Server Authentication Method" description="EXM Mail Server Authentication Method to enter into config" tags="Hidden,NoStore" defaultValue="__MailServerAuthenticationMethod__">
    <parameterEntry kind="XmlFile" scope="App_Config\\Include\\EmailExperience\\Sitecore\.EDS\.Providers\.CustomSmtp\.config$" match="//sitecore/exm/eds/smtpSettings/authenticationMethod/text()" />
  </parameter>
</parameters>

这将生成SetParameters.xml文件,如下所示。

<?xml version="1.0" encoding="utf-8"?>
<parameters>
  <setParameter name="IIS Web Application Name" value="ParametersTest" />
  <setParameter name="Mail Server" value="__MailServer__" />
  <setParameter name="Mail Server User Name" value="__MailServerUserName__" />
  <setParameter name="Mail Server Password" value="__MailServerPassword__" />
  <setParameter name="Mail Server Port" value="__MailServerPort__" />
  <setParameter name="EXM Mail Server SSL or TLS Enabled" value="__MailServerSslOrTlsEnabled__" />
  <setParameter name="EXM Mail Server Authentication Method" value="__MailServerAuthenticationMethod__" />
</parameters>

到目前为止一切顺利!我希望将值替换为__placeholder__结构,以便我们的VSTS发布过程可以用正确的环境变量替换这些值。

现在的问题是,在部署时,userNamepassword节点不会被\App_Config\Include\EmailExperience\Sitecore.EDS.Providers.CustomSmtp.config文件替换。结果如下所示。

<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
    <sitecore>
        <exm>
            <eds>
                ...
                <smtpSettings type="Sitecore.EDS.Core.Net.Smtp.SmtpSettings, Sitecore.EDS.Core" singleInstance="true">
                    <server>__MailServer__</server>
                    <port>__MailServerPort__</port>
                    <userName></userName>
                    <password></password>
                    <authenticationMethod>__MailServerAuthenticationMethod__</authenticationMethod>
                    <startTls>__MailServerSslOrTlsEnabled__</startTls>
                    <proxySettings ref="exm/eds/proxySettings" />
                </smtpSettings>
                ...
            </eds>
        </exm>
    </sitecore>
</configuration>

这很奇怪,因为匹配属性中的xpath与Mail Server Port参数完全相同,例如......我还尝试更新parameters.xml文件,如下所示。

<?xml version="1.0" encoding="utf-8" ?>
<parameters>
  <parameter name="Mail Server" description="Mail server to enter into config" tags="Hidden,NoStore" defaultValue="__MailServer__">
    <parameterEntry kind="XmlFile" scope="App_Config\\Include\\Sitecore\.Smtp\.config$" match="//sitecore/settings/setting[@name='MailServer']/@value" />
    <parameterEntry kind="XmlFile" scope="App_Config\\Include\\EmailExperience\\Sitecore\.EDS\.Providers\.CustomSmtp\.config$" match="//*[local-name()='server']/text()" />
  </parameter>
  <parameter name="Mail Server User Name" description="Mail Server User Name to enter into config" tags="Hidden,NoStore" defaultValue="__MailServerUserName__">
    <parameterEntry kind="XmlFile" scope="App_Config\\Include\\Sitecore\.Smtp\.config$" match="//sitecore/settings/setting[@name='MailServerUserName']/@value" />
    <parameterEntry kind="XmlFile" scope="App_Config\\Include\\EmailExperience\\Sitecore\.EDS\.Providers\.CustomSmtp\.config$" match="//*[local-name()='userName']/text()" />
  </parameter>
  <parameter name="Mail Server Password" description="Mail Server Password to enter into config" tags="Hidden,NoStore" defaultValue="__MailServerPassword__">
    <parameterEntry kind="XmlFile" scope="App_Config\\Include\\Sitecore\.Smtp\.config$" match="//sitecore/settings/setting[@name='MailServerPassword']/@value" />
    <parameterEntry kind="XmlFile" scope="App_Config\\Include\\EmailExperience\\Sitecore\.EDS\.Providers\.CustomSmtp\.config$" match="//*[local-name()='password']/text()" />
  </parameter>
  <parameter name="Mail Server Port" description="Mail Server Port to enter into config" tags="Hidden,NoStore" defaultValue="__MailServerPort__">
    <parameterEntry kind="XmlFile" scope="App_Config\\Include\\Sitecore\.Smtp\.config$" match="//sitecore/settings/setting[@name='MailServerPort']/@value" />
    <parameterEntry kind="XmlFile" scope="App_Config\\Include\\EmailExperience\\Sitecore\.EDS\.Providers\.CustomSmtp\.config$" match="//*[local-name()='port']/text()" />
  </parameter>
  <parameter name="EXM Mail Server SSL or TLS Enabled" description="EXM Mail Server SSL/TLS enabled to enter into config" tags="Hidden,NoStore" defaultValue="__MailServerSslOrTlsEnabled__">
    <parameterEntry kind="XmlFile" scope="App_Config\\Include\\EmailExperience\\Sitecore\.EDS\.Providers\.CustomSmtp\.config$" match="//*[local-name()='startTls']/text()" />
  </parameter>
  <parameter name="EXM Mail Server Authentication Method" description="EXM Mail Server Authentication Method to enter into config" tags="Hidden,NoStore" defaultValue="__MailServerAuthenticationMethod__">
    <parameterEntry kind="XmlFile" scope="App_Config\\Include\\EmailExperience\\Sitecore\.EDS\.Providers\.CustomSmtp\.config$" match="//*[local-name()='authenticationMethod']/text()" />
  </parameter>
</parameters>

但这会产生相同的输出......我无法找到userNamepassword节点名称的任何保留名称......

这让我发疯,因为我无法找到解决方案。现在我希望这里的任何人都遇到过这个问题并知道如何解决它。

亲切的问候, Jop Middelkamp

0 个答案:

没有答案