Jep*_*zen 5 azure-devops azure-pipelines azure-pipelines-release-pipeline
我在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文件不存在建议的位置。
是否有一些设置可以让我包含这些文件?还是阻止他们转型?
MSBuild知道如何基于以下设置/属性/参数来转换web.config文件
dotnet publish --configuration Releasedotnet publish --configuration Release /p:PublishProfile=FolderProfiledotnet publish --configuration Release /p:EnvironmentName=Productiondotnet publish --configuration Release /p:CustomTransformFileName=custom.transform我认为对于开发人员来说,仅基于构建配置来实现此目标很典型,并且我相信MSBuild(和dotnet)知道如何基于<DependentUpon>Web.config</DependentUpon>项目或构建脚本文件中Web。[configuration] .config项中的元素来执行此操作。 。
Azure DevOps 发布管道有所不同。管道要在构建/发布项目后转换web.config,并且如果MSBuild(或dotnet)已经尝试过,则不知道该怎么做。从而:
[警告]无法对给定的包应用转换。验证以下内容。
[警告] 1。在构建过程中是否已将转换应用于MSBuild生成的程序包。如果是,请删除csproj文件中每个配置的标签并重新构建。
[警告] 2。确保配置文件和转换文件位于软件包内的同一文件夹中。
<DependentUpon>csproj中每个配置的标签
/p:TransformWebConfigEnabled=FalseMSBuild 的参数。现在,您需要根据文件转换和值替换文档来组织发布管道。
[节]开始:IIS Web App部署
===================================
任务:IIS Web应用程序部署
说明:使用Web部署
版本部署网站或Web应用程序 :0.0.51
作者:Microsoft Corporation
帮助:更多信息
======================== =========== ...
[命令] C:... \ ctt \ ctt.exe s:C:... \ Web.config t:C:... \ Web.Release .config d:C:... \ Web.config pw i
[命令] C:... \ ctt \ ctt.exe s:C:... \ Web.config t:C:... \ Web。 Development.config d:C:... \ Web.config pw我
成功应用了XML转换
...
您的发行版应具有对工件的“访问”权限,作为工件的一部分,这将确保部署代理下载源(不希望的IMHO)。
您需要将web。[stage] .config文件包含在构建工件中,并带有复制任务,或者将其拾取的最小匹配项。
选项2是我走的路线。
这是该任务对我的外观的图像。
该任务将配置放入构建中的构件中,然后可以在发布管道中使用该构件,而无需重新构建xx次。
| 归档时间: |
|
| 查看次数: |
1661 次 |
| 最近记录: |