parameters - MsDeploy parameters.xml : howto refer a parameter?

标签 parameters package msdeploy webdeploy

目前我正在尝试创建一个 Web 部署包。所以我在我的项目的根目录中添加了一个 parameters.xml 并指定了一些自定义参数。
我发现我的很多参数都部分相同。所以我想做某种参数引用。寻找这个,我来了 Reference for the Web Application Package .在那里它说如下:

Hidden - A Hidden parameter is not shown to the user as part of the installation UI. A Hidden parameter must have a defaultValue set. These parameters are used either to set a hard-coded default value or to set a computed default value. Hard-coded defaults are sometimes used when establishing a parameter for future use. Computed values are used to construct a parameter’s value from other parameters. When constructing computed values, you can refer to other parameters by putting the other parameter name surrounded by {}s in the place you want the value. Please refer to the "Connection String" parameter in the example for a common usage of this tag.



因此,根据文档,可以从“vdeDashboardAddress”中引用参数“vdeHostName”,方法是在“vdeDashboardAddress”上设置属性 defaultValue="https://{vdeHostname}/"和 tags="Hidden"。

这让我找到了 parameters.xml 的以下代码:
<parameters>
  <parameter name="vdeHostname" description="Please provide the hostname" defaultValue="www.test.com">
    <description culture="en">The hostname of the website.</description>
    <parameterEntry kind="XmlFile"
                    scope="obj\\Release\\Package\\PackageTmp\\Configuration\\hosts\.config$"
                    match="/hostConfigurationSection/hostConfigurations/add[@name='Default']/@host" />
  </parameter>
  <parameter name="vdeDashboardAddress" defaultValue="https://{vdeHostname}/" tags="Hidden">
    <description culture="en">The https address of the Dashboard.</description>
    <parameterEntry kind="XmlFile"
                    scope="obj\\Release\\Package\\PackageTmp\\Configuration\\identity\.config$"
                    match="/system.identityModel/identityConfiguration[@name='Default']/audienceUris/add/@value" />
  </parameter>
<parameters>

然而,情况似乎并非如此。它不会引用/替换 defaultValue 中的属性部分。
目前正在输出:
<audienceUris>
  <add value="https://{vdeHostname}/" />
</audienceUris>

我在这里找到的唯一一个提到我的问题的帖子是 How to get Deploy.cmd to fill in replacement fields from Parameters.xml
  • 有谁知道我在这里做错了什么?
  • 规范不正确?那么,如何在parameters.xml 中做部分替换呢?

  • 先感谢您!

    最好的问候, rdvanbuuren

    最佳答案

    我不确定,但 scope属性对我来说看起来很可疑。我面前的(工作)参数文件中的所有范围元素的形式都是 scope="\\Path\\To\\File\.extension$"假定指定的路径从部署应用程序的根文件夹开始。 (例如,最常见的是 scope="\\Web\.config$" 。)我的工作文件中的所有范围属性都不包括路径的 Package\PackageTmp 部分,即使该路径存在于 WebDeploy 使用的 zip 文件中。

    关于parameters - MsDeploy parameters.xml : howto refer a parameter?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23150728/

    相关文章:

    function - 对于函数参数,未定义命名空间或模块 'XXXXX'

    php - 如何在服务器中获取 curl header

    Python只导入一个子包而不导入其他子包

    java - 如何使用 import javax.microedition.io.HttpConnection; Java 中的 SE 应用程序

    iis - 将parameters.xml 或setParams.xml 替换为Azure DevOps Release Pipeline 变量

    java - 如何在运行时将参数传递给进程

    c++ - 结构作为函数的参数 : more efficient to copy or dereference?

    json - 如何将 Bower.json 中的每个依赖项更新到最新版本?

    asp.net - 自定义配置部分的 Web.Config 转换

    msbuild - csproj/msbuild 是否可以将文件作为可选内容包含在内?