一,引言
我們是否正在爲如何快速的編譯、部署客戶端應用程序而煩惱?這也是博主最近遇到的問題。目前博主所在公司主要做項目級的定製化開發,多以 C/S 架構的 WPF 程序爲主,每次到了協助開發團隊給實施團隊編譯好的要測試程序包時,就會出現多人協助,編譯、打包好的二進制程序包 pull 最新代碼 ,以及實施同事無法及時的獲取到有新程序發佈的通知等問題。有了這樣的背景,博主所在團隊開始準備開始瞭解,使用團隊協作系統 ----- Azure DevOps,通過自動化軟件交付來爲用戶提供持續價值。
二,正文
1, Azure DevOps 創建項目
Project name:”NetCore_WPF_Sample“
Visibility:”Private“(根據實際項目需求)
Version control:”Git“
Work item process:”Agile“
點擊 ”Create“ 創建新的項目
2,配置 Azure DevOps 流水線
選擇 ”Pipelines =》“pepelines“,點擊 ”Create Pipeline“ 創建持續集成管道
選擇 ”GitHUb“ Yaml
選擇好需要項目,開始配置 ”azure-pipelines.yml“
# .NET Desktop # Build and run tests for .NET Desktop or Windows classic desktop solutions. # Add steps that publish symbols, save build artifacts, and more: # https://docs.microsoft.com/azure/devops/pipelines/apps/windows/dot-net trigger: - master pool: vmImage: 'windows-latest' variables: solution: '**/*.sln' buildPlatform: 'Any CPU' buildConfiguration: 'Release' steps: - task: NuGetToolInstaller@1 - task: NuGetCommand@2 inputs: restoreSolution: '$(solution)' - task: VSBuild@1 inputs: solution: '$(solution)' platform: '$(buildPlatform)' configuration: '$(buildConfiguration)' clean: true - task: VSTest@2 inputs: platform: '$(buildPlatform)' configuration: '$(buildConfiguration)' - task: PublishSymbols@2 displayName: 'Publish symbols path' inputs: SearchPattern: '**\bin\**\*.pdb' PublishSymbols: false continueOnError: true - task: CopyFiles@2 displayName: 'Copy Files to: $(build.artifactstagingdirectory)' inputs: SourceFolder: 'Standard.Tool.Platform' Contents: '**\bin\$(BuildConfiguration)\**' TargetFolder: '$(build.artifactstagingdirectory)' condition: succeededOrFailed()
調整完 yml 文件後,點擊 ”Run“ 執行 pipeline
點擊 ”Run“ 開始執行
此時我們的 pipeline 任務正在執行,我們可以點擊 ”Job“ 查看詳細作業
作業完成後,我們就可以看到編譯好的程序包
點擊 ”Download artifacts“ 直接下載編譯好的二進制程序包
Bingo!!!🎉✌️🎉✌️🎉✌️🎉✌️
此演示步驟實現了 NET 的桌面應用程序的持續集成與持續編譯,當我們 pipeline 監測到 master 分支有變動後,就會立即執行管道作業,可以確保我們不必再人工拉取代碼,編譯,發佈二進制程序包了。
三,結尾
作者:Allen
版權:轉載請在文章明顯位置註明作者及出處。如發現錯誤,歡迎批評指正。