相关疑难解决方法(0)

为每个版本环境转换Azure网站部署的web.config

在Visual Studio Team Services(Visual Studio Online)中,我有三个发布环境,每个环境都有一个Azure Website Deploy步骤.

我可以通过指定拾取Web.Uat.config的"BuildConfiguration"变量(例如Uat)来转换构建步骤的web.config.

但是我有多个使用此构建配置的发布环境,它们都需要转换Web配置(例如Dev,Test,Uat,Live).

是否可以在Azure网站部署步骤之前指定要用于每个发布环境的Web配置转换?

注意:我意识到可以在Azure门户网站的"所有设置"下为网站指定简单的appsettings和connectionstrings,但我需要做的不仅仅是转换这些简单的设置,并且已经为我的解决方案中的每个环境配置了Web配置转换

azure-deployment azure-devops

5
推荐指数
1
解决办法
2111
查看次数

如何在Web部署zip中包含我的配置转换文件?

我在Azure Devops中建立了一个新的构建和部署管道。它是一个较旧的Web应用程序,其中包含一些用于web.config的转换文件。过去,我们会根据多少个环境来构建相同的代码x次。正如我从这里阅读的那样,这不再是必需的https://docs.microsoft.com/zh-cn/azure/devops/pipelines/tasks/transforms-variable-substitution?view=vsts#xmltransform

看来部署管道可以从我的转换文件中获取更改。

但是问题是我的其他转换文件没有包含在包中,所以我收到了以下警告消息:

[warning]Unable to apply transformation for the given package. Verify the following.
[warning]1. Whether the Transformation is already applied for the MSBuild generated package during build. If yes, remove the <DependentUpon> tag for each config in the csproj file and rebuild. 
[warning]2. Ensure that the config file and transformation files are present in the same folder inside the package.
Run Code Online (Sandbox Code Playgroud)

是的,当我下载工件时,Web。[stage] .config文件不存在建议的位置。

是否有一些设置可以让我包含这些文件?还是阻止他们转型?

azure-devops azure-pipelines azure-pipelines-release-pipeline

5
推荐指数
1
解决办法
1661
查看次数

如何在部署作业期间设置 XML 转换的环境名称?

好吧,伙计们,尝试一下 Azure多阶段管道功能,但不太幸运地使用部署作业进行 xml 转换。

更新:这没有使用 Azure DevOps 中的经典部署/发布 UI

到目前为止我所做的:

  1. 从构建过程中删除转换。尝试一次构建并随处部署
  2. 通过删除 csproj 中的节点来验证 web.{stage}.config 文件是否包含在 webdeploy 包中
  3. 设置名为“开发”的舞台

管道yaml

trigger:
  batch: false # If batch set to true, when a pipeline is running, the system waits until the run is completed,
  branches:
    include:
    - staging-devops
  paths:
    include:
    - myProject/*
    - API/*

variables:
  BuildConfiguration: 'Release'
  BuildPlatform: 'Any CPU'
  System.Debug: true

stages:
- stage: Build
  displayName: 'Build project'
  jobs:
  - job:
    displayName: 'Build and package client'
    pool:
      vmImage: …
Run Code Online (Sandbox Code Playgroud)

azure azure-deployment azure-devops

3
推荐指数
1
解决办法
1610
查看次数