只有累積,沒有奇蹟

2019年2月8日 星期五

[Nuget] The term 'nuget.exe' is not recognized as the name of a cmdlet, function, script file, or operable program

問題 
接開發完 Libary 專案要上傳到 nuget server 時,要將 package 檔案透過指令 push 噴 error 錯誤訊息 nuget.exe : The term 'nuget.exe' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the n ame, or if a path was included, verify that the path is correct and try again. ,此篇簡單紀錄遇到這問題時該如何解決。

如何解決
Nuget 官網下載網頁可以得知,在 Visual Studio 任何版本並不包含 nuget.exe,如果有需要上傳 package 檔案需要另外安裝 NuGet command line tool,目前 nuget.exe 推薦的版本為 v4.9.2

可以透過下列兩種方式安裝 nuget command line tool
Package Manage Console
Tools > Nuget Package Manager > Package Manage Console 輸入以下指令安裝
Install-Package NuGet.CommandLine
Manage Nuget Package
Tools > Manage Nuget Package > 輸入 NuGet.CommandLine > Install

Retry
安裝完畢之後,我們重新 push 一次
nuget.exe push {package file} {apikey} -Source http://localhost/nuget
如上圖所示即可透過 command line 上傳成功
Happy new year :)

參考
nuget



0 意見:

張貼留言

Copyright © m@rcus 學習筆記 | Powered by Blogger

Design by Anders Noren | Blogger Theme by NewBloggerThemes.com