【发布时间】:2019-07-23 08:12:33
【问题描述】:
我有一个 ASP.Net 框架 (v4.7) Web 应用程序,我在 Azure Devops Server (2019) 中有一个构建管道。
有一个 Visual Studio 构建任务可以很好地构建解决方案并将站点发布到 _PublishedWebsites 文件夹。问题是,该版本的 web.config 转换尚未应用,它仍然有 debug="true" 设置,这不是我想要的自动部署。
任务的 msbuild 参数是:/p:outdir="$(build.artifactstagingdirectory)",并且构建的 BuildConfiguration 变量设置为 release。
当我使用 Visual Studio 发布项目时,应用了 web.release.config 转换,并且已从发布内容中的 web.config 文件中删除了调试属性。
这里有什么我遗漏的吗?
编辑:构建管道 YAML:
queue:
name: Default
demands:
- msbuild
- visualstudio
#Your build pipeline references an undefined variable named ‘Parameters.solution’. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab. See https://go.microsoft.com/fwlink/?linkid=865972
#Your build pipeline references an undefined variable named ‘Parameters.solution’. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab. See https://go.microsoft.com/fwlink/?linkid=865972
#Your build pipeline references the ‘BuildPlatform’ variable, which you’ve selected to be settable at queue time. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab, and then select the option to make it settable at queue time. See https://go.microsoft.com/fwlink/?linkid=865971
#Your build pipeline references the ‘BuildConfiguration’ variable, which you’ve selected to be settable at queue time. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab, and then select the option to make it settable at queue time. See https://go.microsoft.com/fwlink/?linkid=865971
#Your build pipeline references the ‘BuildPlatform’ variable, which you’ve selected to be settable at queue time. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab, and then select the option to make it settable at queue time. See https://go.microsoft.com/fwlink/?linkid=865971
#Your build pipeline references the ‘BuildConfiguration’ variable, which you’ve selected to be settable at queue time. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab, and then select the option to make it settable at queue time. See https://go.microsoft.com/fwlink/?linkid=865971
#Your build pipeline references an undefined variable named ‘Parameters.ArtifactName’. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab. See https://go.microsoft.com/fwlink/?linkid=865972
steps:
- task: NuGetCommand@2
displayName: 'NuGet restore'
inputs:
restoreSolution: '$(Parameters.solution)'
- task: VSBuild@1
displayName: 'Build solution'
inputs:
solution: '$(Parameters.solution)'
vsVersion: 16.0
msbuildArgs: '/p:outdir="$(build.artifactstagingdirectory)"'
platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)'
- task: VisualStudioTestPlatformInstaller@1
displayName: 'Visual Studio Test Platform Installer'
inputs:
versionSelector: latestStable
- task: VSTest@2
displayName: 'Test Assemblies'
inputs:
testAssemblyVer2: |
$(build.artifactstagingdirectory)\*test*.dll
!**\obj\**
vsTestVersion: toolsInstaller
platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)'
- task: PublishSymbols@2
displayName: 'Publish symbols path'
inputs:
SearchPattern: '**\bin\**\*.pdb'
PublishSymbols: false
continueOnError: true
- script: |
cd ProjectName.Web.CMS
copy cmsimport.lic bin /y
displayName: 'Copy CMSImport licence to bin folder'
- script: |
ECHO Copying over the umbraco, umbraco_client and CMSImport content for deployment.
xcopy ProjectName.Web.CMS\packages\UmbracoCms.7.5.14\UmbracoFiles\umbraco $(build.artifactstagingdirectory)\_PublishedWebsites\ProjectName.Web.CMS\umbraco\ /s /e /r /y
xcopy "ProjectName.Web.CMS\packages\UmbracoCms.7.5.14\UmbracoFiles\umbraco_client" $(build.artifactstagingdirectory)\_PublishedWebsites\ProjectName.Web.CMS\umbraco_client\ /s /e /r /y
xcopy ProjectName.Web.CMS\packages\CMSImport.3.5\content\umbraco $(build.artifactstagingdirectory)\_PublishedWebsites\ProjectName.Web.CMS\umbraco\ /s /e /r /y
displayName: 'Copy umbraco related content to staging'
enabled: false
- script: |
cd ProjectName.Web.CMS
move robots_UAT.txt $(build.artifactstagingdirectory)\_PublishedWebsites\ProjectName.Web.CMS\robots.txt
displayName: 'Add robots.txt file to artifacts staging directory'
- task: ArchiveFiles@2
displayName: 'Archive $(build.artifactstagingdirectory)\_PublishedWebsites\ProjectName.Web.CMS\'
inputs:
rootFolderOrFile: ' $(build.artifactstagingdirectory)\_PublishedWebsites\ProjectName.Web.CMS\'
includeRootFolder: false
archiveFile: '$(Build.ArtifactStagingDirectory)/ProjectName.Web.CMS.zip'
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact'
inputs:
PathtoPublish: '$(build.artifactstagingdirectory)\ProjectName.Web.CMS.zip'
ArtifactName: '$(Parameters.ArtifactName)'
【问题讨论】:
-
发布管道应该进行转换
-
@ShaykiAbramczyk 你是对的,它应该转换,但它没有。
-
你能分享你的发布管道配置吗?
-
@ShaykiAbramczyk 我已经为构建管道添加了 YAML。
-
那么你在构建管道中进行部署吗?
标签: asp.net msbuild azure-devops continuous-integration