Baget 配置Nuget私服

Baget 配置Nuget私服

安装Baget

Docker

创建baget.env 环境文件

vim /data/baget.env
# The following config is the API Key used to publish packages.
# You should change this to a secret value to secure your server.
ApiKey=NUGET-SERVER-API-KEY

Storage__Type=FileSystem
Storage__Path=/var/baget/packages
Database__Type=Sqlite
Database__ConnectionString=Data Source=/var/baget/baget.db
Search__Type=Database

docker 一键运行脚本

docker run -d --name nuget-server -p 5555:80 --env-file baget.env -v "/data/baget-data:/var/baget" loicsharma/baget:latest

开启代理模式

Docker

进入容器

docker exec -it nuget /bin/sh
cd /app
apt-get update
apt-get install vim
vim appsettings.json

修改文件配置 Enabled->ture

Mirror": {
        "Enabled":  true,
        "PackageSource": "https://api.nuget.org/v3/index.json"
    },

修改某个解决方案的源

Windows

切换到解决方案目录下
终端运行

dotnet new nugetconfig

然后修改文件内对应的源链接即可

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <!--To inherit the global NuGet package sources remove the <clear/> line below -->
    <clear />
    <add key="nuget" value="http://bt.bxshare.top:71/v3/index.json" />
  </packageSources>
</configuration>

修改本地Nuget默认源

Windows

打开文件 %appdata%\NuGet\NuGet.Confignuget.org value 替换为自己的即可

<packageSources>
    <add key="nuget.org" value="http://bt.bxshare.top:71/v3/index.json" protocolVersion="3" />
    <add key="Microsoft Visual Studio Offline Packages" value="C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\" />
</packageSources>
无标签
评论区
头像