有时我们不想对外公开源码,同时又想在VisualStudio中通过Nuget包管理器来统一管理这些内部动态库,这时就可以在本地搭建一个NuGet服务器。
这是一个轻量级的NuGet服务器
将下载好的release版本BaGet解压至 C:\inetpub\wwwroot\BaGet
在IIS中新建应用程序池

新建网站,并指定BaGetAppPool 作为应用程序池,绑定域名 test.com
重点来了,修改BaGet站点下的 web.config 配置
修改appsettings.json配置
{ "ApiKey": "ACMR", "Urls":"http://*:82", "PackageDeletionBehavior": "HardDelete", "AllowPackageOverwrites": true, "Database": { "Type": "Sqlite", "ConnectionString": "Data Source=baget.db" }, "Storage": { "Type": "FileSystem", "Path": "" }, "Search": { "Type": "Database" }, "Mirror": { "Enabled": true, // Uncomment this to use the NuGet v2 protocol //"Legacy": true, "PackageSource": "https://api.nuget.org/v3/index.json" }, "Logging": { "IncludeScopes": false, "Debug": { "LogLevel": { "Default": "Warning" } }, "Console": { "LogLevel": { "Microsoft.Hosting.Lifetime": "Information", "Default": "Warning" } } } } C:\Windows\System32\drivers\etc\hosts
127.0.0.1 test.com
这样就可以在本地模拟通过域名来访问了。

接下来把做好的nuget包 推上去就可以了。