在 Visual Studio 中使用 Azure DevOps Service 的開發體驗

Where
4 min readApr 1, 2021

--

Visual-Studio-2019–banner | TechiDaily

一般來說,自己是比較習慣使用 Command 的方式在 local 端實行版控直接推上 Azure DevOps Repo,然而 git 的指令入門容易,深入亦可以很複雜, Visual Studio 出了相對應的工具,能讓你透過 GUI 對Azure DevOps 有更多的操作,在完成程式碼的同時,讓你實做版控、嵌入工單。

將專案推到遠端版控庫

將要 push 到 Repo 的 sln 專案開啟,開啟專案後會如下圖所示。

接著,要將專案加入使用 Git 來作為 Source Control,方式有兩種

  • 在右下角的地方有一個 Add Source Control 的地方,選擇 Git
  • 在 sln 專案項目的地方選擇 右鍵 > Add Solution to Source Control

之後,你就可以看到專案已經被加入使用 Git 來作為Source Control,這邊的步驟就如同你在終端機下的指令 git init .,會幫你在專案的根目錄底下建立一個 .git 和 .gitignore 的檔案,然後進行 addcommit 的動作,因此這時候只需要把遠端的 repository 加入就可以囉!

在上方工具欄找到 View > Team Explorer 可以把 Visual Studio 中對於小組專案管理的工具列叫出,在這裡你可以將目前的專案與 Azure DevOps Service 的 Repo、GitHub 或其他你自有的 Local Repository(當然也包含 Azure DevOps Service)做連結。

選擇 Publish Git Repo 和遠端的 Azure DevOps Service Repo 連結

在 Azure DevOps Service 上建立專案時,系統會自動建立一個新的 Repository,因此我們在 Repository Name 旁邊的 Advanced 裡面可以選擇到目前現有的版控庫,選擇完成後點選 Publish Repository 的動作就會開始幫你上傳到Remote Repository上。

選擇要上傳的 Project 名稱和 Repository Name,你也可以直接在這邊新增一個 Repository。

回到 Azure DevOps Service 的頁面,可以看到剛剛的 Source Code 已經上傳到雲端了!

嵌入 Azure DevOps Work Item

在上方的工具欄找到 Team > Team Explorer 後點選會跳出 Team Explorer 的視窗,在這邊可以設定對於 Azure DevOps Service 的連線。

接著選擇你的帳戶、Azure DevOps Service 上的組織及專案進行連結或是Clone 現有的 repository

或是亦可透過 Connect 的地方對現有的 project 進行連結

Visual Studio 的 Team Explorer 可用來對已經連接到的 Azure DevOps Service Project 來做像是程式碼的簽入簽出、新增分支、合併分支、發 PR、上 Tag、新增 Work Item 等設定,而不需要透過自行下 git 指令。

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

No responses yet

Write a response