1

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

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 发布过程可以用正确的环境变量替换这些值。

现在的问题是,在部署时,文件中的userNameandpassword节点不会被替换\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>

这很奇怪,因为 match 属性中的 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节点名称的保留名称的任何信息......

这让我发疯,因为我找不到解决方案。现在我希望这里的任何人以前都经历过这个问题并且知道如何解决它。

亲切的问候,乔普·米德尔坎普

4

0 回答 0