1.安裝nuget.exe ,下載地址https://www.nuget.org/downloads,下載後直接將nuget.exe複製到C:\Windows\System32目錄下
2.cmd執行下面命令為倉庫設定apikey
nuget setapikey e500146f-8594-32a3-9041-6ad7d2bf8d9b -source http://192.168.10.22:8081/repository/nuget-hosted/
3.執行powershell指令碼,批次將nuget包上傳到Nexus私有倉庫,指令碼如下
$destFolder = Get-Location; cd ..\.. $rootFolder=Get-Location; #編譯anycpu的包 $anycpuPath =$rootFolder.Path + "\src\Infrastructures\Adnc.Infra.sln"; $output=$destFolder.Path+"\packages" Write-Output $anycpuPath dotnet restore $anycpuPath dotnet build --no-restore -c Release $anycpuPath dotnet pack $anycpuPath -c Release --output $output; cd $output nuget push *.nupkg -Source http://192.168.10.22:8081/repository/nuget-hosted/ pause exitShell
4.到Nexus檢視包推送結果