简体   繁体   English

替换 appsettings 和连接字符串 Octopus Deploy

[英]Replace appsettings and connection strings Octopus Deploy

I am using Octopus deploy to replace appsettings and connectionstrings我正在使用 Octopus deploy 来替换 appsettings 和 connectionstrings

In my web.config i have the following these files are excluuded from checkin在我的 web.config 我有以下这些文件从签入中排除

<appSettings configSource="MyLocalAppconfig" > </appSettings> 
<connectionStrings configSource="MyLocalDB.config"> </connectionStrings>

Then in my web.release.config然后在我的 web.release.config

i have the following我有以下几点

  <appSettings>
    <add key="AppSetting1" value=""/>
    <add key="AppSetting2" value=""/>
  </appSettings>
  <connectionStrings>
    <add name="MyDB1" connectionString=""/>
  </connectionStrings>

In Octopus I have variables setup with the same name.在 Octopus 中,我设置了同名的变量。 I also have the following steps ticket in the deployment我在部署中也有以下步骤票

在此处输入图片说明

But when I deploy Octopus says但是当我部署 Octopus 时说

No matching appSetting, applicationSetting, nor connectionString names were found in: C:\\Octopus\\Applications\\XXX\\XX\\1.0.1\\Web.config在以下位置找不到匹配的 appSetting、applicationSetting 或 connectionString 名称:C:\\Octopus\\Applications\\XXX\\XX\\1.0.1\\Web.config

You are not using valid XDT.您没有使用有效的 XDT。 You have to tell it how to transform those.你必须告诉它如何转换这些。 In your case, you want to insert them since they don't exist in the original file.在您的情况下,您想插入它们,因为它们不存在于原始文件中。

Are you sure the Web.release.config is part of your package?你确定Web.release.config是你的包的一部分吗? The NuGet Package Explorer is very convenient for viewing the contents of your package. NuGet 包资源管理器对于查看包的内容非常方便。 (you could also add .zip extension to the package file name (or rename .nupkg to .zip) and it will just open when you double click it). (您也可以将 .zip 扩展名添加到包文件名(或将 .nupkg 重命名为 .zip),双击它时它就会打开)。

Maybe what you're seeing is collateral damage.也许你看到的是附带损害。 No Web.release.config was found, so no transformation took place at all... so there are no appSettings or connectionStrings.没有找到 Web.release.config,所以根本没有发生任何转换……所以没有 appSettings 或 connectionStrings。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM