架設內部 NuGet Server 的兩三事 (03)

透過 VSTS 建置 Build 流程打包推送到私有的 Private NuGet Server 主要流程如下:

  1. 只要把本地開發的專案丟至 CI Server Build 即可產出 .nupkg
  2. 透過 NuGet push 至私有 Server

 

NuGet restore (Option)

NuGet restore 上一篇我們透過 NuGetPackageTemplate 產出的 .sln 把需要裝的 packages 載進去 project。

Build solution

Build solution 建置過後就會產生 .nupkg 在對應 \bin\組態的路徑下。

NuGet push

比較要注意的 push 的這個 Task 要設置的參數比 restore 還要多。 

在 Target feed location 選擇 External NuGet server 並點選 New

把 ProGet 中擁有 Publish Packages 的帳號密碼當作 ApiKey 填入並把 URL 正確填上如下圖。

正確執行完後就能夠在 ProGet 提供的介面上預覽你上傳的 packages 囉。

Delete files 

後來我會穿插了一個 Delete files Task 因為每次建置都要把原本留在 workspace 中的 .nupkg 清乾淨。

這樣下次觸發時確保不會把舊的 .nupkg push 上去。