我想为具有Azure存储库的.NETCore2 api项目设置CI / CD。
我希望将发行版部署到Windows计算机c:\ mywebapi
上的文件夹中我已经建立了一个构建管道来进行构建,并建立了一个发布管道来进行部署。
但是,文件作为目标计算机的C:\ agent_work \ rX \ a \ myrelease \ drop \ WebApp.Zip降落在我的计算机上。 X是发布编号。
如何自动完成将zip解压缩到c:\ mywebapi文件夹的最后一步?
这是构建Yaml
resources:
- repo: self
queue:
name: Hosted VS2017
demands:
- msbuild
- visualstudio
- vstest
#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 ‘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: NuGetToolInstaller@0
displayName: 'Use NuGet 4.4.1'
inputs:
versionSpec: 4.4.1
- task: NuGetCommand@2
displayName: 'NuGet restore'
inputs:
restoreSolution: '$(Parameters.solution)'
- task: VSBuild@1
displayName: 'Build solution'
inputs:
solution: '$(Parameters.solution)'
msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:DesktopBuildPackageLocation="$(build.artifactstagingdirectory)\WebApp.zip" /p:DeployIisAppPath="Default Web Site"'
platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)'
- task: VSTest@2
displayName: 'Test Assemblies'
inputs:
testAssemblyVer2: |
**\$(BuildConfiguration)\*test*.dll
!**\obj\**
platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)'
- task: PublishSymbols@2
displayName: 'Publish symbols path'
inputs:
SearchPattern: '**\bin\**\*.pdb'
PublishSymbols: false
continueOnError: true
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact'
inputs:
PathtoPublish: '$(build.artifactstagingdirectory)'
ArtifactName: '$(Parameters.ArtifactName)'
答案 0 :(得分:0)
如果只需要将zip文件解压缩到特定文件夹(此处为c:\mywebapi
),则可以在构建管道中使用Extract Files
任务,则不需要发布管道。 (参考下面的屏幕截图,解压缩到以下示例中的\\172.17.16.147\TestShare\0927
)
read
和write
)访问特定文件夹(c:\mywebapi
您的情况)。Copy Files
任务以将WebApp.Zip
文件复制到
$(Build.SourcesDirectory)
Extract Files
任务以解压缩文件更新:
好吧,默认情况下,在构建过程中,它仅生成一个zip文件并发布Artifact作为部署源。
要将应用程序部署到目标计算机或网站,您需要创建一个发布管道并链接工件源,然后使用IIS Web App Deploy
任务进行部署。如果要部署为虚拟应用程序,则还需要提供虚拟应用程序名称...