怎样搭建私有NuGet服务器-BaGet
怎样搭建私有NuGet服务器-BaGet,很多新手对此不是很清楚,为了帮助大家解决这个难题,下面小编将为大家详细讲解,有这方面需求的人可以来学习下,希望你能有所收获。
我们提供的服务有:成都网站制作、网站建设、微信公众号开发、网站优化、网站认证、正阳ssl等。为成百上千企事业单位解决了网站和推广的问题。提供周到的售前咨询和贴心的售后服务,是有科学管理、有技术的正阳网站制作公司
前言
NuGet是用于微软.NET(包括 .NET Core)开发平台的软件包管理器。NuGet能够令你在项目中添加、移除和更新引用的工作变得更加快捷方便。
通常使用NuGet都是官方的服务,但你有没有想过搭建自己的NuGet呢?在私有的NuGet上托管一些自己的类库,公司内部的类库等。搭建私有NuGet的方法有很多,比如NuGet.Server、ProGet、MyGet等等。下面使用的是BaGet,搭建过程也非常简单,下面进入正题。
开始
搭建BaGet
BaGet是一个构建于ASP.NET Core 基础上的 NuGet V3 服务器的开源实现。
github地址:https://github.com/loic-sharma/BaGet
下载release包,我下载的是最新预览版,你也可以选择其他版本:
https://github.com/loic-sharma/BaGet/releases/download/v0.3.0-preview4/BaGet.zip

你可以按需要修改一下端口配置,默认是5000:

在解压目录下打开命令行,执行:dotnet BaGet.dll

浏览器访问:http://localhost:8020/

这样,NuGet服务就搭建完成了,是不是很简单?
上传程序包
随便创建一个类库项目用于测试:

右键项目,选择打包:

打包完成会得到一个nupkg文件:

当然,你也可以选择Release模式:

看一下Upload命令:

在上面打包目录下打开命令行执行:dotnet nuget push -s http://localhost:8020/v3/index.json MyTestLibrary.1.0.0.nupkg

再次查看Packages:

在vs中使用
在vs2019中打开:工具-选项-NuGet包管理器-程序包源。添加一个源,输入名称,源:http://localhost:8020/v3/index.json

接下来就可以正常使用了:

其他
程序包的作者,说明,版本号等信息可以在这里修改:

依赖项也完全不用担心:

因为BaGet是基于ASP.NET Core开发,所以天生跨平台,你可以在windows,mac,linux或者docker中轻松部署。另外,BaGet也没有复杂的环境依赖,数据库默认Sqlite,很轻量,部署起来非常容易。
看完上述内容是否对您有帮助呢?如果还想对相关知识有进一步的了解或阅读更多相关文章,请关注创新互联行业资讯频道,感谢您对创新互联的支持。
本文名称:怎样搭建私有NuGet服务器-BaGet
文章网址:http://myzitong.com/article/ghhjop.html