This document explains how to configure your environment to use our private NuGet repository with Basic Authentication, restore packages, and publish new versions.
nuget.config)To use the private repository, create a local nuget.config file inside a .nuget folder in the solution root.
.nuget folder.nuget
.nuget/nuget.config<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="PrivateRepo" value="https://nuget.itransys.eu/v3/index.json" />
</packageSources>
<packageSourceCredentials>
<PrivateRepo>
<add key="Username" value="YOUR_USERNAME" />
<add key="ClearTextPassword" value="YOUR_PASSWORD" />
</PrivateRepo>
</packageSourceCredentials>
</configuration>
YOUR_USERNAME and YOUR_PASSWORD with the credentials provided.You may configure the repository using either nuget.exe or dotnet nuget.
nuget.exenuget.exe sources Add ^
-Name "PrivateRepo" ^
-Source "https://nuget.itransys.eu/v3/index.json" ^
-UserName "YOUR_USERNAME" ^
-Password "YOUR_PASSWORD" ^
-StorePasswordInClearText ^
-ConfigFile ".\.nuget\nuget.config"
dotnet nugetni .\.nuget\nuget.config
Insert:
<?xml version="1.0" encoding="utf-8"?>
<configuration></configuration>
dotnet nuget add source "https://nuget.itransys.eu/v3/index.json" ^
--name "PrivateRepo" ^
--username "YOUR_USERNAME" ^
--password "YOUR_PASSWORD" ^
--store-password-in-clear-text ^
--configfile ".\.nuget\nuget.config"
dotnet restore
or:
dotnet restore --source PrivateRepo
dotnet add package PackageName --version 1.2.3 --source PrivateRepo
The server supports publishing via HTTP POST:
dotnet nuget push $packagePath -s https://nuget.itransys.eu/v3/index.json
POST https://nuget.itransys.eu/v3/publish
Form field: package
curl -X POST "https://nuget.itransys.eu/v3/publish" ^
-u "YOUR_USERNAME:YOUR_PASSWORD" ^
-F "package=@MyPackage.1.0.0.nupkg"
$packagePath = "C:\....\file.nupkg"
$url = "https://nuget.itransys.eu/v3/index.json"
$username = "USER_NAME"
$password = "USER_PASSWORD"
# Create .nuget directory if it doesn't exist
$nugetDir = [System.IO.Path]::Combine($PSScriptRoot, '.nuget')
if (-not (Test-Path $nugetDir)) {
New-Item -ItemType Directory -Path $nugetDir | Out-Null
}
# Create the nuget.config file with the required XML content
$nugetConfigPath = [System.IO.Path]::Combine($nugetDir, 'nuget.config')
@'
# Add the private NuGet source to the nuget.config
dotnet nuget add source $url `
--name "PrivateRepo" --username $username `
--password $password `
--store-password-in-clear-text `
--configfile $nugetConfigPath
# Push the package to the private NuGet source
dotnet nuget push $packagePath `
--source "PrivateRepo" `
--configfile $nugetConfigPath
Balík je možné nainštalovať priamo bez nutnosti pridávať nový zdroj do nuget.config pomocou príkazu:
dotnet add package NUGET_NAME \
--source "https://nuget.itransys.eu/v3/index.json" \
--username USER_NAME \
--password USER_PASSWORD
curl.exe -u "USER_NAME:USER_PASSWORD" "https://localhost:58976/v3/query?q=*" |
ConvertFrom-Json |
Select-Object -ExpandProperty data |
Select id, version
nuget locals http-cache -clear
dotnet nuget locals http-cache --clear
%USERPROFILE%\.nuget\plugins-cache
Delete entire folder.