
# Configuration

The anybill POS SDK is distributed as NuGet packages through anybill's private package repository (JFrog Artifactory). The packages are not available on nuget.org, so the anybill feed has to be added as an additional package source before they can be installed.

Access to the feed requires an anybill account. Request one via <dev@anybill.de>; you will receive a username and a password or access token, which are used as NuGet credentials below.

The packages target .NET Standard 2.1 and can therefore be referenced from .NET Core 3.0 or later and .NET 5 or later.

## Feed URL

| Protocol | URL |
| --- | --- |
| NuGet v3 (recommended) | `https://anybill.jfrog.io/artifactory/api/nuget/v3/anybill.POS.Client.CSharp/index.json` |
| NuGet v2 (legacy clients only) | `https://anybill.jfrog.io/artifactory/api/nuget/anybill.POS.Client.CSharp` |

Use the v3 URL unless your tooling cannot handle v3 feeds. The feed does not allow anonymous access; every request has to be authenticated with your anybill credentials.

Choose one of the following ways to register the feed.

## dotnet CLI

```bash
dotnet nuget add source https://anybill.jfrog.io/artifactory/api/nuget/v3/anybill.POS.Client.CSharp/index.json \
  --name anybill \
  --username <USERNAME> \
  --password <PASSWORD_OR_TOKEN>
```

> **Tip**
> On Linux and macOS the dotnet CLI cannot encrypt stored passwords. Append `--store-password-in-clear-text` to the command above, or use a project-level `NuGet.config` with environment variables as described below.

## nuget.exe

```cmd
nuget sources Add -Name anybill -Source https://anybill.jfrog.io/artifactory/api/nuget/v3/anybill.POS.Client.CSharp/index.json -UserName <USERNAME> -Password <PASSWORD_OR_TOKEN>
```

`nuget setapikey` is not required. An API key is only used for pushing packages, not for restoring them.

## Visual Studio

1. Open **Tools > NuGet Package Manager > Package Manager Settings > Package Sources**.
2. Add a new package source, for example with the name `anybill`.
3. Paste the v3 feed URL from the table above into the **Source** field and confirm.
4. Visual Studio asks for your anybill username and password or token the first time it accesses the feed.

## Project-level NuGet.config

For teams and build servers, add a `NuGet.config` next to your solution file. NuGet expands `%VARIABLE%` placeholders from environment variables, so no credentials have to be committed to source control.

```xml
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
    <add key="anybill" value="https://anybill.jfrog.io/artifactory/api/nuget/v3/anybill.POS.Client.CSharp/index.json" protocolVersion="3" />
  </packageSources>
  <packageSourceCredentials>
    <anybill>
      <add key="Username" value="%ANYBILL_NUGET_USERNAME%" />
      <add key="ClearTextPassword" value="%ANYBILL_NUGET_PASSWORD%" />
    </anybill>
  </packageSourceCredentials>
</configuration>
```

If you prefer to edit the user-level configuration instead, it is located at:

- Windows: `%appdata%\NuGet\NuGet.Config`
- macOS/Linux, dotnet CLI: `~/.nuget/NuGet/NuGet.Config`
- macOS/Linux, Mono and `nuget.exe`: `~/.config/NuGet/NuGet.Config`

## Next steps

Once the feed is registered, install the packages listed on the [C# Integration](./csharp_integration) page.

## Troubleshooting

- **401 Unauthorized**: The credentials are missing, wrong or the token has expired. The feed cannot be accessed anonymously; check the stored username and password or token.
- **Feed not found / NU1301**: Make sure the URL contains `/api/nuget/v3/` and ends with `/index.json` when it is registered as a v3 source.
- **Source works in one tool but not in another (macOS/Linux)**: The dotnet CLI and Mono-based `nuget.exe` read different user-level `NuGet.config` files (see above). Register the source in both files or use a project-level `NuGet.config`.
