換用 Git 後踩到的第一個小坑,某個 NuGet Packager 專案打包時發生錯誤,NuGet.log 顯示問題出在找不到 lib 資料夾:

[INFO] : NuGet Packager 2.0.3
[INFO] : Creating backup...
[INFO] : Renamed Epe.WebApi.Client.1.5.nupkg to Epe.WebApi.Client.1.5.nupkg.bak
[INFO] : Updating NuGet...
[INFO] : Checking for updates from https://nuget.org/api/v2/.
[INFO] : Currently running NuGet.exe 2.2.0.
[INFO] : Updating NuGet.exe to 5.0.2.
[INFO] : Creating package...
[INFO] : Attempting to build package from 'Package.nuspec'.
[ERROR] : 找不到路徑 'X:\GIT-SRC\CORE\Epe.WebApi.Client.NuGet\lib' 的一部分。
[INFO] : Exit Code: 1

lib 本身是空資料夾,用於打包過程放入 DLL 與 PDB 檔案。專案在 TFVC 運作多年,搬到 Git 後才出錯。

比對專案與實體資料夾,發現 lib、content、src 三個空資料夾不見了。

很快想起我的 Git 小抄有寫到:

空目錄不會被提交,解法為在目錄下放一個 .keep 或 .gitkeep 讓 Git 感應到它

TFVC 會將空資料夾簽入版控,但 Git 不會。解法很簡單,手動補建資料夾,用 touch .gitkeep 新增無內容空檔再 Commit,結束這回合。

A NuGet packager project failed to build after moved from TFVC to Git and I learned to add .gitkeep in empty folders to force Git commit them.


Comments

Be the first to post a comment

Post a comment