我有一个ASP.Net框架(v4.7)的Web应用程序,我在Azure DevOps Server(2019)上有一个构建管道。
有一个Visual Studio Build任务,可以很好地构建解决方案并将站点发布到_PublishedWebsites文件夹。问题是,发布版本的web.config转换没有应用,它仍然设置为debug="true",这不适用于自动部署。
任务的msbuild参数是:/p:outdir="$(build.artifactstagingdirectory)",构建的BuildConfiguration变量设置为release。
当我使用Visual Studio发布项目时,会应用web.release.config转换,并从发布内容的web.config文件中删除debug属性。
我错过了什么吗?
编辑:构建管道YAML:
有一个Visual Studio Build任务,可以很好地构建解决方案并将站点发布到_PublishedWebsites文件夹。问题是,发布版本的web.config转换没有应用,它仍然设置为debug="true",这不适用于自动部署。
任务的msbuild参数是:/p:outdir="$(build.artifactstagingdirectory)",构建的BuildConfiguration变量设置为release。
当我使用Visual Studio发布项目时,会应用web.release.config转换,并从发布内容的web.config文件中删除debug属性。
我错过了什么吗?
编辑:构建管道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)'